summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-05-28 13:23:09 -0400
committerNick Mathewson <nickm@torproject.org>2015-05-28 13:23:09 -0400
commit5dce1829bf8615f78975e1b7d651e97c266b509a (patch)
treeb4dfd374730f24e8f964bc77e04a3d7dd9378cab /src
parent97a2dbb3e33c3444390e345c248663a928f8df09 (diff)
downloadtor-5dce1829bf8615f78975e1b7d651e97c266b509a.tar.gz
tor-5dce1829bf8615f78975e1b7d651e97c266b509a.zip
Avoid double-free on rend_add_service() failure
Rend_add_service() frees its argument on failure; no need to free again. Fixes bug 16228, bugfix on 0.2.7.1-alpha Found by coverity; this is CID 1301387.
Diffstat (limited to 'src')
-rw-r--r--src/or/rendservice.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 0329d70924..d27b06d5df 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -256,7 +256,7 @@ rend_service_free_all(void)
}
/** Validate <b>service</b> and add it to rend_service_list if possible.
- * Return 0 on success and -1 on failure.
+ * Return 0 on success. On failure, free <b>service</b> and return -1.
*/
static int
rend_add_service(rend_service_t *service)
@@ -868,7 +868,6 @@ rend_service_add_ephemeral(crypto_pk_t *pk,
/* Initialize the service. */
if (rend_add_service(s)) {
- rend_service_free(s);
return RSAE_INTERNAL;
}
*service_id_out = tor_strdup(s->service_id);