2014-07-04 12:45:38

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH] monitor: Fix possible resource leak

From: Andrei Emeltchenko <[email protected]>

This fixes following memory leak:
...
==14887== 24 bytes in 1 blocks are definitely lost in loss record 2 of 4
==14887== at 0x4C2CC70: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14887== by 0x425B6C: btsnoop_open (btsnoop.c:83)
==14887== by 0x424837: analyze_trace (analyze.c:262)
==14887== by 0x40249A: main (main.c:189)
...
---
monitor/analyze.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/analyze.c b/monitor/analyze.c
index a5ed5f4..5288cf3 100644
--- a/monitor/analyze.c
+++ b/monitor/analyze.c
@@ -272,7 +272,7 @@ void analyze_trace(const char *path)
break;
default:
fprintf(stderr, "Unsupported packet format\n");
- return;
+ goto done;
}

dev_list = queue_new();
--
1.9.1



2014-07-04 13:21:44

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] monitor: Fix possible resource leak

Hi Andrei,

On Fri, Jul 04, 2014, Andrei Emeltchenko wrote:
> This fixes following memory leak:
> ...
> ==14887== 24 bytes in 1 blocks are definitely lost in loss record 2 of 4
> ==14887== at 0x4C2CC70: calloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==14887== by 0x425B6C: btsnoop_open (btsnoop.c:83)
> ==14887== by 0x424837: analyze_trace (analyze.c:262)
> ==14887== by 0x40249A: main (main.c:189)
> ...
> ---
> monitor/analyze.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

Johan