Skip to content
Snippets Groups Projects
Commit 5dce1829 authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

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.
parent 97a2dbb3
No related branches found
No related tags found
No related merge requests found
o Minor bugfixes (hidden services):
- Avoid crashing with a double-free bug when we create an
ephemeral hidden service but adding it fails for some reason.
Fixes bug 16228; bugfix on 0.2.7.1-alpha.
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment