aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-01-16 05:27:19 +0000
committerNick Mathewson <nickm@torproject.org>2008-01-16 05:27:19 +0000
commit4a3b7496f0c47b0d00c9744698eaa237e601b32a (patch)
treefdefeb3c864306cc52f3e9f5dadb8414f8a99187 /src/or/rendservice.c
parent24aae484c93b09c7fc735e53874f02a22e4b5b43 (diff)
downloadtor-4a3b7496f0c47b0d00c9744698eaa237e601b32a.tar
tor-4a3b7496f0c47b0d00c9744698eaa237e601b32a.tar.gz
r17639@catbus: nickm | 2008-01-15 19:09:21 -0500
Fix some hard to trigger but nonetheless real memory leaks spotted by an anonymous contributor. Needs review. Partial backport candidate. svn:r13147
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r--src/or/rendservice.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 60bced974..1a355c883 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -284,6 +284,7 @@ rend_config_services(or_options_t *options, int validate_only)
log_warn(LD_CONFIG,
"Got multiple HiddenServiceNodes lines for a single "
"service.");
+ rend_service_free(service);
return -1;
}
service->intro_prefer_nodes = tor_strdup(line->value);
@@ -292,6 +293,7 @@ rend_config_services(or_options_t *options, int validate_only)
log_warn(LD_CONFIG,
"Got multiple HiddenServiceExcludedNodes lines for "
"a single service.");
+ rend_service_free(service);
return -1;
}
service->intro_exclude_nodes = tor_strdup(line->value);
@@ -308,6 +310,9 @@ rend_config_services(or_options_t *options, int validate_only)
if (strlen(version_str) != 1 || strspn(version_str, "02") != 1) {
log_warn(LD_CONFIG,
"HiddenServiceVersion can only be 0 and/or 2.");
+ SMARTLIST_FOREACH(versions, char *, cp, tor_free(cp));
+ smartlist_free(versions);
+ rend_service_free(service);
return -1;
}
version = atoi(version_str);
@@ -317,6 +322,8 @@ rend_config_services(or_options_t *options, int validate_only)
* value; otherwise leave it at -1. */
if (versions_bitmask == 1 << 0) service->descriptor_version = 0;
if (versions_bitmask == 1 << 2) service->descriptor_version = 2;
+ SMARTLIST_FOREACH(versions, char *, cp, tor_free(cp));
+ smartlist_free(versions);
}
}
if (service) {
@@ -618,7 +625,7 @@ rend_service_introduce(origin_circuit_t *circuit, const char *request,
if (len != REND_COOKIE_LEN+DH_KEY_LEN) {
log_warn(LD_PROTOCOL, "Bad length %u for INTRODUCE2 cell.", (int)len);
reason = END_CIRC_REASON_TORPROTOCOL;
- return -1;
+ goto err;
}
r_cookie = ptr;