[PATCH 2/3] grep: Fix two memory leaks

Subsystems: the rest

DORMANTno replies

2 messages, 1 author, 2016-06-15 · open the first message on its own page

[PATCH 2/3] grep: Fix two memory leaks

From: Dan McGee <hidden>
Date: 2016-06-15 22:48:08

We duplicate the grep_opt structure when using grep threads, but didn't
later free either the patterns attached to this new structure or the
structure itself.

Signed-off-by: Dan McGee <redacted>
---
Found these with valgrind.

-Dan

 builtin-grep.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-grep.c b/builtin-grep.c
index 9bd467c..0ef849c 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -205,6 +205,8 @@ static void *run(void *arg)
 
 		work_done(w);
 	}
+	free_grep_patterns(arg);
+	free(arg);
 
 	return (void*) (intptr_t) hit;
 }
-- 
1.6.6.1

Re: [PATCH 2/3] grep: Fix two memory leaks

From: Dan McGee <hidden>
Date: 2016-06-15 22:48:08

On Sat, Jan 30, 2010 at 9:42 AM, Dan McGee [off-list ref] wrote:
We duplicate the grep_opt structure when using grep threads, but didn't
later free either the patterns attached to this new structure or the
structure itself.

Signed-off-by: Dan McGee <redacted>
---
Found these with valgrind.
Ignore the misleading numbers in the subject, there isn't more to see
here...whoops.

-Dan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help