aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorulfvonbelow <strilen@tilde.club>2023-01-29 06:21:24 -0600
committerMartin Schanzenbach <schanzen@gnunet.org>2023-02-06 13:50:05 +0900
commita3cc7ff4796e32ddfa13f22307877d4f52a7cd58 (patch)
tree13bf2af55325fa76995ff451a1994c4b3aeee64a
parenta1d9941261dc4028d814b0904793c78f4ca45958 (diff)
downloadgnunet-a3cc7ff4796e32ddfa13f22307877d4f52a7cd58.tar.gz
gnunet-a3cc7ff4796e32ddfa13f22307877d4f52a7cd58.zip
NAT: don't leak AddrEntries when unregistering.
Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
-rw-r--r--src/nat/nat_api.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c
index 3072cff7f..31f8f388d 100644
--- a/src/nat/nat_api.c
+++ b/src/nat/nat_api.c
@@ -673,6 +673,9 @@ GNUNET_NAT_request_reversal (struct GNUNET_NAT_Handle *nh,
673void 673void
674GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh) 674GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh)
675{ 675{
676 struct AddrEntry *ae;
677 struct AddrEntry *next;
678
676 if (NULL != nh->mq) 679 if (NULL != nh->mq)
677 { 680 {
678 GNUNET_MQ_destroy (nh->mq); 681 GNUNET_MQ_destroy (nh->mq);
@@ -683,6 +686,14 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh)
683 GNUNET_SCHEDULER_cancel (nh->reconnect_task); 686 GNUNET_SCHEDULER_cancel (nh->reconnect_task);
684 nh->reconnect_task = NULL; 687 nh->reconnect_task = NULL;
685 } 688 }
689 next = nh->ae_head;
690 while (NULL != next)
691 {
692 ae = next;
693 next = next->next;
694 GNUNET_CONTAINER_DLL_remove (nh->ae_head, nh->ae_tail, ae);
695 GNUNET_free (ae);
696 }
686 GNUNET_free (nh->reg); 697 GNUNET_free (nh->reg);
687 GNUNET_free (nh); 698 GNUNET_free (nh);
688} 699}