diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-11-30 12:16:39 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-11-30 12:16:39 -0500 |
commit | 9da99b4939b66b001cf73b1f12fb71c745461591 (patch) | |
tree | 465351bb4b263ddfa2a1c4e1a43b5b8324534b3e /src | |
parent | e83862a0ff7be42f5cbcb35c20b0405ca5bb27fd (diff) | |
download | tor-9da99b4939b66b001cf73b1f12fb71c745461591.tar.gz tor-9da99b4939b66b001cf73b1f12fb71c745461591.zip |
Fix a memory leak in error path of my default-torrc code
Fixes Coverity CID # 500
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/or/config.c b/src/or/config.c index fb5b49a53d..391d2905f6 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -4399,7 +4399,8 @@ int options_init_from_torrc(int argc, char **argv) { char *cf=NULL, *cf_defaults=NULL; - int i, retval, command; + int i, command; + int retval = -1; static char **backup_argv; static int backup_argc; char *command_arg = NULL; @@ -4466,19 +4467,16 @@ options_init_from_torrc(int argc, char **argv) retval = options_init_from_string(cf_defaults, cf, command, command_arg, &errmsg); - tor_free(cf); - tor_free(cf_defaults); - if (retval < 0) - goto err; - - return 0; err: + + tor_free(cf); + tor_free(cf_defaults); if (errmsg) { log(LOG_WARN,LD_CONFIG,"%s", errmsg); tor_free(errmsg); } - return -1; + return retval < 0 ? -1 : 0; } /** Load the options from the configuration in <b>cf</b>, validate |