[PATCH] genl: Fix memory leak
by Ravi kumar Veeramally
==7322== Command: unit/test-genl
==7322==
==7322==
==7322== HEAP SUMMARY:
==7322== in use at exit: 192 bytes in 5 blocks
==7322== total heap usage: 17 allocs, 12 frees, 1,672 bytes allocated
==7322==
==7322== 192 (104 direct, 88 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
==7322== at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7322== by 0x403D1D: l_malloc (util.c:62)
==7322== by 0x402653: family_alloc (genl.c:144)
==7322== by 0x4029FA: l_genl_new (genl.c:506)
==7322== by 0x402BEF: l_genl_new_default (genl.c:548)
==7322== by 0x400FDA: main (test-genl.c:49)
==7322==
==7322== LEAK SUMMARY:
==7322== definitely lost: 104 bytes in 1 blocks
==7322== indirectly lost: 88 bytes in 4 blocks
==7322== possibly lost: 0 bytes in 0 blocks
==7322== still reachable: 0 bytes in 0 blocks
==7322== suppressed: 0 bytes in 0 blocks
---
ell/genl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ell/genl.c b/ell/genl.c
index 88f73bc..dca8e1b 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -593,6 +593,8 @@ void l_genl_unref(struct l_genl *genl)
l_io_destroy(genl->io);
genl->io = NULL;
+ l_genl_family_unref(genl->nlctrl);
+
l_queue_destroy(genl->family_list, family_free);
if (genl->close_on_unref)
--
2.1.0
7 years, 5 months