Loading changes/cov-leaks 0 → 100644 +6 −0 Original line number Diff line number Diff line o Minor bugfixes: - Resolve some memory leaks found by coverity in the unit tests, on exit in tor-gencert, and on a failure to compute digests for our own keys when generating a v3 networkstatus vote. These leaks should never have affected anyone in practice. src/or/dirserv.c +8 −8 Original line number Diff line number Diff line Loading @@ -2578,14 +2578,6 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key, tor_assert(private_key); tor_assert(cert); if (resolve_my_address(LOG_WARN, options, &addr, NULL, &hostname)<0) { log_warn(LD_NET, "Couldn't resolve my hostname"); return NULL; } if (!hostname || !strchr(hostname, '.')) { tor_free(hostname); hostname = tor_dup_ip(addr); } if (crypto_pk_get_digest(private_key, signing_key_digest)<0) { log_err(LD_BUG, "Error computing signing key digest"); return NULL; Loading @@ -2594,6 +2586,14 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key, log_err(LD_BUG, "Error computing identity key digest"); return NULL; } if (resolve_my_address(LOG_WARN, options, &addr, NULL, &hostname)<0) { log_warn(LD_NET, "Couldn't resolve my hostname"); return NULL; } if (!hostname || !strchr(hostname, '.')) { tor_free(hostname); hostname = tor_dup_ip(addr); } if (options->VersioningAuthoritativeDir) { client_versions = format_versions_list(options->RecommendedClientVersions); Loading src/test/test_addr.c +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ test_addr_basic(void) } done: ; tor_free(cp); } #define test_op_ip6_(a,op,b,e1,e2) \ Loading src/test/test_util.c +15 −13 Original line number Diff line number Diff line Loading @@ -1189,19 +1189,19 @@ test_util_strmisc(void) } /* Test str-foo functions */ cp = tor_strdup("abcdef"); test_assert(tor_strisnonupper(cp)); cp[3] = 'D'; test_assert(!tor_strisnonupper(cp)); tor_strupper(cp); test_streq(cp, "ABCDEF"); tor_strlower(cp); test_streq(cp, "abcdef"); test_assert(tor_strisnonupper(cp)); test_assert(tor_strisprint(cp)); cp[3] = 3; test_assert(!tor_strisprint(cp)); tor_free(cp); cp_tmp = tor_strdup("abcdef"); test_assert(tor_strisnonupper(cp_tmp)); cp_tmp[3] = 'D'; test_assert(!tor_strisnonupper(cp_tmp)); tor_strupper(cp_tmp); test_streq(cp_tmp, "ABCDEF"); tor_strlower(cp_tmp); test_streq(cp_tmp, "abcdef"); test_assert(tor_strisnonupper(cp_tmp)); test_assert(tor_strisprint(cp_tmp)); cp_tmp[3] = 3; test_assert(!tor_strisprint(cp_tmp)); tor_free(cp_tmp); /* Test memmem and memstr */ { Loading Loading @@ -2325,6 +2325,8 @@ test_util_listdir(void *ptr) done: tor_free(fname1); tor_free(fname2); tor_free(fname3); tor_free(dir1); tor_free(dirname); if (dir_contents) { SMARTLIST_FOREACH(dir_contents, char *, cp, tor_free(cp)); Loading src/tools/tor-gencert.c +3 −0 Original line number Diff line number Diff line Loading @@ -547,6 +547,9 @@ main(int argc, char **argv) if (signing_key) EVP_PKEY_free(signing_key); tor_free(address); tor_free(identity_key_file); tor_free(signing_key_file); tor_free(certificate_file); crypto_global_cleanup(); return r; Loading Loading
changes/cov-leaks 0 → 100644 +6 −0 Original line number Diff line number Diff line o Minor bugfixes: - Resolve some memory leaks found by coverity in the unit tests, on exit in tor-gencert, and on a failure to compute digests for our own keys when generating a v3 networkstatus vote. These leaks should never have affected anyone in practice.
src/or/dirserv.c +8 −8 Original line number Diff line number Diff line Loading @@ -2578,14 +2578,6 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key, tor_assert(private_key); tor_assert(cert); if (resolve_my_address(LOG_WARN, options, &addr, NULL, &hostname)<0) { log_warn(LD_NET, "Couldn't resolve my hostname"); return NULL; } if (!hostname || !strchr(hostname, '.')) { tor_free(hostname); hostname = tor_dup_ip(addr); } if (crypto_pk_get_digest(private_key, signing_key_digest)<0) { log_err(LD_BUG, "Error computing signing key digest"); return NULL; Loading @@ -2594,6 +2586,14 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key, log_err(LD_BUG, "Error computing identity key digest"); return NULL; } if (resolve_my_address(LOG_WARN, options, &addr, NULL, &hostname)<0) { log_warn(LD_NET, "Couldn't resolve my hostname"); return NULL; } if (!hostname || !strchr(hostname, '.')) { tor_free(hostname); hostname = tor_dup_ip(addr); } if (options->VersioningAuthoritativeDir) { client_versions = format_versions_list(options->RecommendedClientVersions); Loading
src/test/test_addr.c +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ test_addr_basic(void) } done: ; tor_free(cp); } #define test_op_ip6_(a,op,b,e1,e2) \ Loading
src/test/test_util.c +15 −13 Original line number Diff line number Diff line Loading @@ -1189,19 +1189,19 @@ test_util_strmisc(void) } /* Test str-foo functions */ cp = tor_strdup("abcdef"); test_assert(tor_strisnonupper(cp)); cp[3] = 'D'; test_assert(!tor_strisnonupper(cp)); tor_strupper(cp); test_streq(cp, "ABCDEF"); tor_strlower(cp); test_streq(cp, "abcdef"); test_assert(tor_strisnonupper(cp)); test_assert(tor_strisprint(cp)); cp[3] = 3; test_assert(!tor_strisprint(cp)); tor_free(cp); cp_tmp = tor_strdup("abcdef"); test_assert(tor_strisnonupper(cp_tmp)); cp_tmp[3] = 'D'; test_assert(!tor_strisnonupper(cp_tmp)); tor_strupper(cp_tmp); test_streq(cp_tmp, "ABCDEF"); tor_strlower(cp_tmp); test_streq(cp_tmp, "abcdef"); test_assert(tor_strisnonupper(cp_tmp)); test_assert(tor_strisprint(cp_tmp)); cp_tmp[3] = 3; test_assert(!tor_strisprint(cp_tmp)); tor_free(cp_tmp); /* Test memmem and memstr */ { Loading Loading @@ -2325,6 +2325,8 @@ test_util_listdir(void *ptr) done: tor_free(fname1); tor_free(fname2); tor_free(fname3); tor_free(dir1); tor_free(dirname); if (dir_contents) { SMARTLIST_FOREACH(dir_contents, char *, cp, tor_free(cp)); Loading
src/tools/tor-gencert.c +3 −0 Original line number Diff line number Diff line Loading @@ -547,6 +547,9 @@ main(int argc, char **argv) if (signing_key) EVP_PKEY_free(signing_key); tor_free(address); tor_free(identity_key_file); tor_free(signing_key_file); tor_free(certificate_file); crypto_global_cleanup(); return r; Loading