Skip to contentSkip to conversation

unit/test-queue: Fix memory leak

PATCH In review Luiz Augusto von Dentz 1 participant 2 messages Jun 27, 2014 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 unit/test-queue: Fix memory leak

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following memory leak:

32 bytes in 1 blocks are definitely lost in loss record 20 of 35
at 0x4C291D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x400DC2: queue_new (queue.c:65)
by 0x400AA5: test_foreach_remove_all (test-queue.c:92)
by 0x4E9E5E0: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9E7A5: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9EB1A: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x40083E: main (test-queue.c:109)

---
 unit/test-queue.c | 1 +
 1 file changed, 1 insertion(+)
unit/test-queue.c +1 -0
index af7dfd3..5cbe529 100644
@@ -96,6 +96,7 @@ static void test_foreach_remove_all(void)
 	queue_push_tail(queue, UINT_TO_PTR(2));
 
 	queue_foreach(queue, foreach_remove_all, queue);
+	queue_destroy(queue, NULL);
 }
 
 int main(int argc, char *argv[])
Signature · 1 line
1.9.3
author maintainer
#1 lore raw

Hi,

Quoted 29 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This fixes the following memory leak:

32 bytes in 1 blocks are definitely lost in loss record 20 of 35
at 0x4C291D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x400DC2: queue_new (queue.c:65)
by 0x400AA5: test_foreach_remove_all (test-queue.c:92)
by 0x4E9E5E0: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9E7A5: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
by 0x4E9EB1A: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x40083E: main (test-queue.c:109)

---
 unit/test-queue.c | 1 +
 1 file changed, 1 insertion(+)
unit/test-queue.c +1 -1
index af7dfd3..5cbe529 100644
@@ -96,6 +96,7 @@ static void test_foreach_remove_all(void)
        queue_push_tail(queue, UINT_TO_PTR(2));
 
        queue_foreach(queue, foreach_remove_all, queue);
+       queue_destroy(queue, NULL);
 }
 
 int main(int argc, char *argv[])
--
Quoted 1 line

1.9.3

Pushed.

Signature · 1 line
Luiz Augusto von Dentz