View Issue Details

IDProjectCategoryView StatusLast Update
0007627GNUnetrevocation servicepublic2023-06-01 20:26
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.19.4Fixed in Version0.19.4 
Summary0007627: Potential(?) memory leak in gnunet-service-revocation
DescriptionCleanup is done in shutdown_task. There is space in run() between where the allocation of things that shutdown_task cleans up begins and where shutdown_task is added. This space includes multiple error sites that can cause an early return. They call GNUNET_SCHEDULER_shutdown, but shutdown_task hasn't been added yet.
Additional InformationPatch attached.
Not an actual problem given these allocations only happen once AFAIK.
Tagsmemory-leak, patch
Attached Files
0001-REVOCATION-add-shutdown-task-earlier.patch (1,629 bytes)   
From 62c6348d94c8571e98df3c86928dd47fe84bb002 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 05:47:00 -0600
Subject: [PATCH] REVOCATION: add shutdown task earlier.

There are many things that can go wrong and require cleanup before the
shutdown task is currently added. In these cases, GNUNET_SCHEDULER_shutdown is
run and run() is returned from. At present, the only harm in running
shutdown_task earlier would be it unconditionally destroying revocation_map,
so we can add it as soon as that exists.
---
 src/revocation/gnunet-service-revocation.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index e10771557..2cee70857 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -899,6 +899,8 @@ run (void *cls,
   cfg = c;
   revocation_map = GNUNET_CONTAINER_multihashmap_create (16,
                                                          GNUNET_NO);
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                 NULL);
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (cfg,
                                              "REVOCATION",
@@ -1001,8 +1003,6 @@ run (void *cls,
   }
   GNUNET_free (fn);
 
-  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
-                                 NULL);
   peers = GNUNET_CONTAINER_multipeermap_create (128,
                                                 GNUNET_YES);
   /* Connect to core service and register core handlers */
-- 
2.38.1

Activities

schanzen

2023-02-06 05:34

administrator   ~0019761

Thanks again
d8cbbb5b6ba10b2c1ca5d889ecb3788f931d8566

schanzen

2023-06-01 20:26

administrator   ~0020243

released some time ago

Issue History

Date Modified Username Field Change
2023-01-29 22:32 ulfvonbelow New Issue
2023-01-29 22:32 ulfvonbelow Tag Attached: memory-leak
2023-01-29 22:32 ulfvonbelow Tag Attached: patch
2023-01-29 22:32 ulfvonbelow File Added: 0001-REVOCATION-add-shutdown-task-earlier.patch
2023-02-06 05:34 schanzen Assigned To => schanzen
2023-02-06 05:34 schanzen Status new => resolved
2023-02-06 05:34 schanzen Resolution open => fixed
2023-02-06 05:34 schanzen Fixed in Version => 0.19.4
2023-02-06 05:34 schanzen Note Added: 0019761
2023-02-06 05:46 schanzen Target Version => 0.19.4
2023-06-01 20:26 schanzen Note Added: 0020243
2023-06-01 20:26 schanzen Status resolved => closed