diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-10-18 14:23:19 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-10-18 14:23:19 +0000 |
commit | 959c4963b28f714feffd2369cb69e7c4e8486fe7 (patch) | |
tree | eaa0af0125433ed9315e6c907fe72c432b413641 /src/or/router.c | |
parent | 8f21a0a0b7e695d824201f19b758bf140f4001f3 (diff) | |
download | tor-959c4963b28f714feffd2369cb69e7c4e8486fe7.tar.gz tor-959c4963b28f714feffd2369cb69e7c4e8486fe7.zip |
r15913@catbus: nickm | 2007-10-18 10:22:19 -0400
Fix segfault in init_keys()
svn:r12021
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c index 32aad5dee4..550699ab23 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -510,15 +510,16 @@ init_keys(void) /* 5. Dump fingerprint to 'fingerprint' */ keydir = get_datadir_fname("fingerprint"); log_info(LD_GENERAL,"Dumping fingerprint to \"%s\"...",keydir); - tor_free(keydir); if (crypto_pk_get_fingerprint(get_identity_key(), fingerprint, 1)<0) { log_err(LD_GENERAL,"Error computing fingerprint"); + tor_free(keydir); return -1; } tor_assert(strlen(options->Nickname) <= MAX_NICKNAME_LEN); if (tor_snprintf(fingerprint_line, sizeof(fingerprint_line), "%s %s\n",options->Nickname, fingerprint) < 0) { log_err(LD_GENERAL,"Error writing fingerprint line"); + tor_free(keydir); return -1; } /* Check whether we need to write the fingerprint file. */ @@ -528,10 +529,12 @@ init_keys(void) if (!cp || strcmp(cp, fingerprint_line)) { if (write_str_to_file(keydir, fingerprint_line, 0)) { log_err(LD_FS, "Error writing fingerprint line to file"); + tor_free(keydir); return -1; } } tor_free(cp); + tor_free(keydir); log(LOG_NOTICE, LD_GENERAL, "Your Tor server's identity key fingerprint is '%s %s'", |