summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-04-30 19:21:15 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-04-30 19:21:15 +0300
commit9084a90b00e51c92595347f8ac796df93876dc1a (patch)
treeebfb659d0879f3edd4dba0f1f49af8d409978427
parenta44aca5453ca944369a9ab9b589499bed56c3599 (diff)
parente39b53ef7de4ac6705869fd153da7b0f87c48ee6 (diff)
downloadtor-9084a90b00e51c92595347f8ac796df93876dc1a.tar.gz
tor-9084a90b00e51c92595347f8ac796df93876dc1a.zip
Merge branch 'tor-github/pr/936'
-rw-r--r--changes/coverity_falsepos4
-rw-r--r--scripts/maint/practracker/exceptions.txt6
-rw-r--r--src/core/or/protover.c3
-rw-r--r--src/feature/rend/rendservice.c1
-rw-r--r--src/lib/net/address.c8
5 files changed, 16 insertions, 6 deletions
diff --git a/changes/coverity_falsepos b/changes/coverity_falsepos
new file mode 100644
index 0000000000..9fbb01a0c1
--- /dev/null
+++ b/changes/coverity_falsepos
@@ -0,0 +1,4 @@
+ o Code simplification and refactoring:
+ - Refactor several places in our code that coverity incorrectly believed
+ that we might have memory leaks, so that we can analyze our software
+ more easily. Closes ticket 30147.
diff --git a/scripts/maint/practracker/exceptions.txt b/scripts/maint/practracker/exceptions.txt
index df19cc4702..d90ed1f4bd 100644
--- a/scripts/maint/practracker/exceptions.txt
+++ b/scripts/maint/practracker/exceptions.txt
@@ -119,7 +119,7 @@ problem function-size /src/core/or/connection_or.c:connection_or_client_learned_
problem function-size /src/core/or/connection_or.c:connection_or_compute_authenticate_cell_body() 235
problem file-size /src/core/or/policies.c 3171
problem function-size /src/core/or/policies.c:policy_summarize() 107
-problem function-size /src/core/or/protover.c:protover_all_supported() 116
+problem function-size /src/core/or/protover.c:protover_all_supported() 117
problem file-size /src/core/or/relay.c 3173
problem function-size /src/core/or/relay.c:circuit_receive_relay_cell() 123
problem function-size /src/core/or/relay.c:relay_send_command_from_edge_() 101
@@ -245,7 +245,7 @@ problem function-size /src/feature/rend/rendmid.c:rend_mid_establish_intro_legac
problem function-size /src/feature/rend/rendparse.c:rend_parse_v2_service_descriptor() 187
problem function-size /src/feature/rend/rendparse.c:rend_decrypt_introduction_points() 104
problem function-size /src/feature/rend/rendparse.c:rend_parse_introduction_points() 131
-problem file-size /src/feature/rend/rendservice.c 4509
+problem file-size /src/feature/rend/rendservice.c 4510
problem function-size /src/feature/rend/rendservice.c:rend_service_prune_list_impl_() 107
problem function-size /src/feature/rend/rendservice.c:rend_config_service() 164
problem function-size /src/feature/rend/rendservice.c:rend_service_load_auth_keys() 178
@@ -256,7 +256,7 @@ problem function-size /src/feature/rend/rendservice.c:rend_service_intro_has_ope
problem function-size /src/feature/rend/rendservice.c:rend_service_rendezvous_has_opened() 117
problem function-size /src/feature/rend/rendservice.c:directory_post_to_hs_dir() 108
problem function-size /src/feature/rend/rendservice.c:upload_service_descriptor() 111
-problem function-size /src/feature/rend/rendservice.c:rend_consider_services_intro_points() 169
+problem function-size /src/feature/rend/rendservice.c:rend_consider_services_intro_points() 170
problem function-size /src/feature/stats/rephist.c:rep_hist_load_mtbf_data() 185
problem function-size /src/feature/stats/rephist.c:rep_hist_format_exit_stats() 148
problem function-size /src/lib/compress/compress.c:tor_compress_impl() 133
diff --git a/src/core/or/protover.c b/src/core/or/protover.c
index 53709ad002..1edf78ec87 100644
--- a/src/core/or/protover.c
+++ b/src/core/or/protover.c
@@ -820,6 +820,8 @@ protover_all_supported(const char *s, char **missing_out)
* ones and, if so, add them to unsupported->ranges. */
if (versions->low != 0 && versions->high != 0) {
smartlist_add(unsupported->ranges, versions);
+ } else {
+ tor_free(versions);
}
/* Finally, if we had something unsupported, add it to the list of
* missing_some things and mark that there was something missing. */
@@ -828,7 +830,6 @@ protover_all_supported(const char *s, char **missing_out)
all_supported = 0;
} else {
proto_entry_free(unsupported);
- tor_free(versions);
}
} SMARTLIST_FOREACH_END(range);
diff --git a/src/feature/rend/rendservice.c b/src/feature/rend/rendservice.c
index 57475a64b0..996e7b9a28 100644
--- a/src/feature/rend/rendservice.c
+++ b/src/feature/rend/rendservice.c
@@ -4227,6 +4227,7 @@ rend_consider_services_intro_points(time_t now)
* directly ourselves. */
intro->extend_info = extend_info_from_node(node, 0);
if (BUG(intro->extend_info == NULL)) {
+ tor_free(intro);
break;
}
intro->intro_key = crypto_pk_new();
diff --git a/src/lib/net/address.c b/src/lib/net/address.c
index 214d8aa3eb..7dec4c8e25 100644
--- a/src/lib/net/address.c
+++ b/src/lib/net/address.c
@@ -2027,8 +2027,12 @@ string_is_valid_nonrfc_hostname(const char *string)
smartlist_split_string(components,string,".",0,0);
- if (BUG(smartlist_len(components) == 0))
- return 0; // LCOV_EXCL_LINE should be impossible given the earlier checks.
+ if (BUG(smartlist_len(components) == 0)) {
+ // LCOV_EXCL_START should be impossible given the earlier checks.
+ smartlist_free(components);
+ return 0;
+ // LCOV_EXCL_STOP
+ }
/* Allow a single terminating '.' used rarely to indicate domains
* are FQDNs rather than relative. */