0001-peerstore-fix-Iteration-memory-leak-in-gnunet-servic.patch (1,842 bytes)
From 4109ffd018ee26e6b70b9de2a8f501b7e32696ee Mon Sep 17 00:00:00 2001
From: ulfvonbelow <striness@tilde.club>
Date: Sat, 4 May 2024 18:09:51 -0500
Subject: [PATCH] peerstore: fix Iteration memory leak in
gnunet-service-peerstore.
---
.../peerstore/gnunet-service-peerstore.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/service/peerstore/gnunet-service-peerstore.c b/src/service/peerstore/gnunet-service-peerstore.c
index 5d0f037a1..3eb224ae8 100644
--- a/src/service/peerstore/gnunet-service-peerstore.c
+++ b/src/service/peerstore/gnunet-service-peerstore.c
@@ -491,6 +491,15 @@ iterate_proc (void *cls,
proc->limit--;
}
+
+static void destroy_iteration(struct Iteration *ic)
+{
+ GNUNET_free (ic->key);
+ GNUNET_free (ic->sub_system);
+ GNUNET_free (ic);
+}
+
+
/**
* Function called once we are done with the iteration and
* allow the zone iteration client to send us more messages.
@@ -512,10 +521,8 @@ iteration_done_client_continue (struct Iteration *ic)
endmsg->rid = htons (ic->request_id);
endmsg->result = htonl (GNUNET_OK);
GNUNET_MQ_send (ic->pc->mq, env);
- GNUNET_free (ic->key);
- GNUNET_free (ic->sub_system);
GNUNET_CONTAINER_DLL_remove (ic->pc->op_head, ic->pc->op_tail, ic);
- GNUNET_free (ic);
+ destroy_iteration (ic);
return;
}
@@ -657,7 +664,7 @@ handle_iterate_stop (void *cls,
return;
}
GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, ic);
- GNUNET_free (ic);
+ destroy_iteration (ic);
GNUNET_SERVICE_client_continue (pc->client);
}
@@ -1098,7 +1105,7 @@ client_disconnect_cb (void *cls,
while (NULL != (iter = pc->op_head))
{
GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, iter);
- GNUNET_free (iter);
+ destroy_iteration (iter);
}
GNUNET_free (pc);
}
--
2.41.0