]> 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)
committerNick Mathewson <nickm@torproject.org>
Tue, 5 Sep 2017 13:26:21 +0000 (09:26 -0400)
Fixes #23319

Cherry-picked from master; bug not in any released Tor.

src/or/hs_descriptor.c
src/or/hs_descriptor.h
src/test/test_hs_descriptor.c

index 616d2f280b4984566420dea124af2d0042c19f86..fae527b2db9b96b0e746e864e7568f792bc7517c 100644 (file)
@@ -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) {
index b8b94792dee37f625a518ea666631997de67a359..136477ae3a82d633139af882543213f635ba9181 100644 (file)
@@ -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 */
index 8f8da361de591297cd722d6ab10d8be580bf6047..7d7ec7d9db7bc18ccd392bcc9beebfedd6c457cc 100644 (file)
@@ -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