[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] test: Fix memory leak in hs_descriptor/decode_bad_signature
commit 7eaf055b280cd324507fa55758148dfee62657b1
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date: Thu Aug 24 16:21:44 2017 -0400
test: Fix memory leak in hs_descriptor/decode_bad_signature
Fixes #23319
Cherry-picked from master; bug not in any released Tor.
---
src/or/hs_descriptor.c | 2 +-
src/or/hs_descriptor.h | 2 ++
src/test/test_hs_descriptor.c | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 616d2f280..fae527b2d 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -167,7 +167,7 @@ desc_intro_point_free(hs_desc_intro_point_t *ip)
}
/* Free the content of the plaintext section of a descriptor. */
-static void
+STATIC void
desc_plaintext_data_free_contents(hs_desc_plaintext_data_t *desc)
{
if (!desc) {
diff --git a/src/or/hs_descriptor.h b/src/or/hs_descriptor.h
index b8b94792d..136477ae3 100644
--- a/src/or/hs_descriptor.h
+++ b/src/or/hs_descriptor.h
@@ -235,6 +235,8 @@ STATIC int desc_sig_is_valid(const char *b64_sig,
STATIC void desc_intro_point_free(hs_desc_intro_point_t *ip);
STATIC size_t decode_superencrypted(const char *message, size_t message_len,
uint8_t **encrypted_out);
+STATIC void desc_plaintext_data_free_contents(hs_desc_plaintext_data_t *desc);
+
#endif /* HS_DESCRIPTOR_PRIVATE */
#endif /* TOR_HS_DESCRIPTOR_H */
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index 8f8da361d..7d7ec7d9d 100644
--- a/src/test/test_hs_descriptor.c
+++ b/src/test/test_hs_descriptor.c
@@ -574,7 +574,8 @@ test_decode_bad_signature(void *arg)
expect_log_msg_containing("Malformed signature line. Rejecting.");
teardown_capture_of_logs();
- done: ;
+ done:
+ desc_plaintext_data_free_contents(&desc_plaintext);
}
static void
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits