diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-01-30 21:05:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-01-30 21:05:47 +0000 |
commit | e4ad1f1629571045dcdcaac8477e1444a1fad5b0 (patch) | |
tree | 89dc50cb59b912769273512886e8521ab6b4f851 /src | |
parent | 88b579dd3317627b6fb61e6bcf7f18182145291f (diff) | |
download | tor-e4ad1f1629571045dcdcaac8477e1444a1fad5b0.tar tor-e4ad1f1629571045dcdcaac8477e1444a1fad5b0.tar.gz |
Freeing twice does *not* make the heap twice as clean.
svn:r1027
Diffstat (limited to 'src')
-rw-r--r-- | src/or/routerlist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index f07aac1b1..871b34b11 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -783,6 +783,7 @@ routerinfo_t *router_get_entry_from_string(const char**s) { log_fn(LOG_WARN, "Missing onion key"); goto err; } /* XXX Check key length */ router->onion_pkey = tok->val.public_key; + tok->val.public_key = NULL; /* Prevent free */ NEXT_TOKEN(); if (tok->tp != K_LINK_KEY) { @@ -793,6 +794,7 @@ routerinfo_t *router_get_entry_from_string(const char**s) { log_fn(LOG_WARN, "Missing link key"); goto err; } /* XXX Check key length */ router->link_pkey = tok->val.public_key; + tok->val.public_key = NULL; /* Prevent free */ NEXT_TOKEN(); if (tok->tp != K_SIGNING_KEY) { @@ -803,6 +805,7 @@ routerinfo_t *router_get_entry_from_string(const char**s) { log_fn(LOG_WARN, "Missing signing key"); goto err; } router->identity_pkey = tok->val.public_key; + tok->val.public_key = NULL; /* Prevent free */ NEXT_TOKEN(); while (tok->tp == K_ACCEPT || tok->tp == K_REJECT) { @@ -1037,10 +1040,12 @@ router_release_token(directory_token_t *tok) switch (tok->tp) { case _SIGNATURE: - free(tok->val.signature); + if (tok->val.signature) + free(tok->val.signature); break; case _PUBLIC_KEY: - crypto_free_pk_env(tok->val.public_key); + if (tok->val.public_key) + crypto_free_pk_env(tok->val.public_key); break; case _ERR: case _EOF: |