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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]