git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] grep: Fix two memory leaks
@ 2010-01-30 15:42 Dan McGee
  2010-01-30 15:45 ` Dan McGee
  0 siblings, 1 reply; 2+ messages in thread
From: Dan McGee @ 2010-01-30 15:42 UTC (permalink / raw)
  To: git; +Cc: Dan McGee

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 <dpmcgee@gmail.com>
---
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-30 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-30 15:42 [PATCH 2/3] grep: Fix two memory leaks Dan McGee
2010-01-30 15:45 ` Dan McGee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).