]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
test: Fix memory leak in hs_descriptor/decode_bad_signature
authorDavid Goulet <dgoulet@torproject.org>
Thu, 24 Aug 2017 20:21:44 +0000 (16:21 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Thu, 24 Aug 2017 20:21:44 +0000 (16:21 -0400)
Fixes #23319

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/or/hs_descriptor.c
src/or/hs_descriptor.h
src/test/test_hs_descriptor.c

index f50e2f85102f0566e9c2f68140e0a20eca604498..4bc54bdb2da06050e737dfdd8888f7af3a822368 100644 (file)
@@ -147,7 +147,7 @@ static token_rule_t hs_desc_intro_point_v3_token_table[] = {
 };
 
 /* 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) {
index ce225d5217cf2aab3a82a8d24ca77367bc51e1eb..3e82746c3572159ccf42fc64558a9efcd3eb5e3b 100644 (file)
@@ -256,6 +256,8 @@ STATIC int desc_sig_is_valid(const char *b64_sig,
                              const char *encoded_desc, size_t encoded_len);
 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 */
index 30a5b23cf281bb2686b9de35e64615faaaa84d59..7f0d1dd1899c2fd3495bcf9e267124e8bc8d6964 100644 (file)
@@ -581,7 +581,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