From 066104e85353bd6eb11ba615b2dd03a2ace190a8 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 5 Sep 2008 20:54:52 +0000 Subject: [PATCH] Backport: Fix numerous memory leaks: some were almost impossible to trigger, and some almost inevitable. svn:r16781 --- src/or/connection_edge.c | 2 ++ src/or/directory.c | 2 +- src/or/rendcommon.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 0197d05c31..b42dadf49c 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -696,6 +696,8 @@ clear_trackexithost_mappings(const char *exitname) MAP_DEL_CURRENT(address); } } STRMAP_FOREACH_END; + + tor_free(suffix); } /** Remove all entries from the addressmap that were set via the diff --git a/src/or/directory.c b/src/or/directory.c index 6e2ccb605f..9cdf4606ac 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2806,7 +2806,7 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers, * receive anything. */ write_http_status_line(conn, 400, "Nonauthoritative directory does not " "accept posted server descriptors"); - return 0; + goto done; } if (authdir_mode_handles_descs(options, -1) && diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index e7ac4a1f0f..dd91d4c402 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -884,6 +884,7 @@ rend_cache_store(const char *desc, size_t desc_len, int published) if (!published && strmap_get_lc(rend_cache, key)) { log_info(LD_REND, "We already have a v2 descriptor for service %s.", safe_str(query)); + rend_service_descriptor_free(parsed); return -1; } /* report novel publication to statistics */