[tor-commits] [torsocks/master] Fix wrong tor_address check for NULL

dgoulet at torproject.org dgoulet at torproject.org
Tue Jun 14 15:10:56 UTC 2016


commit ec4987112695ab338e854c37458a3f811b9ce8f1
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Tue Jun 14 10:53:56 2016 -0400

    Fix wrong tor_address check for NULL
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/common/config-file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/config-file.c b/src/common/config-file.c
index 05ca9cb..a22d4c6 100644
--- a/src/common/config-file.c
+++ b/src/common/config-file.c
@@ -284,13 +284,13 @@ int conf_file_set_tor_address(const char *addr, struct configuration *config)
 		config->conf_file.tor_domain = CONNECTION_DOMAIN_INET6;
 	}
 
-	if (config->conf_file.tor_address == NULL) {
+	if (config->conf_file.tor_address != NULL) {
 		free(config->conf_file.tor_address);
 		config->conf_file.tor_address = NULL;
 	}
 
 	config->conf_file.tor_address = strdup(addr);
-	if (!config->conf_file.tor_address) {
+	if (config->conf_file.tor_address == NULL) {
 		ret = -ENOMEM;
 		goto error;
 	}



More information about the tor-commits mailing list