gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 09/28: GNSRECORD: fix memory leaks in tests.


From: gnunet
Subject: [gnunet] 09/28: GNSRECORD: fix memory leaks in tests.
Date: Mon, 06 Feb 2023 06:19:11 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 72b16124ed7fd7977c984d6a2dde9b6e9f8bdc81
Author: ulfvonbelow <strilen@tilde.club>
AuthorDate: Sun Jan 29 07:06:29 2023 -0600

    GNSRECORD: fix memory leaks in tests.
    
    This allows us to use sanitizers to find bugs that matter.
    
    Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
---
 src/gnsrecord/test_gnsrecord_block_expiration.c | 3 +++
 src/gnsrecord/test_gnsrecord_crypto.c           | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/gnsrecord/test_gnsrecord_block_expiration.c 
b/src/gnsrecord/test_gnsrecord_block_expiration.c
index 69f7f6aa1..3ef02e631 100644
--- a/src/gnsrecord/test_gnsrecord_block_expiration.c
+++ b/src/gnsrecord/test_gnsrecord_block_expiration.c
@@ -78,6 +78,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   rd[1].expiration_time = expiration_abs_shadow.abs_value_us;
   rd[1].record_type = TEST_RECORD_TYPE;
   rd[1].data_size = TEST_RECORD_DATALEN;
+  GNUNET_free (rd[1].data);
   rd[1].data = GNUNET_malloc (TEST_RECORD_DATALEN);
   rd[1].flags = GNUNET_GNSRECORD_RF_SHADOW;
   memset ((char *) rd[1].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
@@ -86,6 +87,8 @@ run (void *cls, char *const *args, const char *cfgfile,
                  GNUNET_GNSRECORD_record_get_expiration_time (2,
                                                               rd,
                                                              
GNUNET_TIME_UNIT_ZERO_ABS).abs_value_us);
+  GNUNET_free (rd[0].data);
+  GNUNET_free (rd[1].data);
   res = 0;
 }
 
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c 
b/src/gnsrecord/test_gnsrecord_crypto.c
index 5b1032f1e..92a7a9f1f 100644
--- a/src/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/gnsrecord/test_gnsrecord_crypto.c
@@ -143,6 +143,8 @@ test_with_type (struct GNUNET_IDENTITY_PrivateKey *privkey)
                                                  s_name,
                                                  &rd_decrypt_cb,
                                                  NULL));
+  for (int i = 0; i < RECORDS; i++) GNUNET_free(s_rd[i].data);
+  GNUNET_free (s_rd);
   GNUNET_free (block);
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]