Code

grep: Fix two memory leaks
authorDan McGee <dpmcgee@gmail.com>
Sat, 30 Jan 2010 15:42:58 +0000 (09:42 -0600)
committerJunio C Hamano <gitster@pobox.com>
Sat, 30 Jan 2010 17:11:00 +0000 (09:11 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-grep.c

index 9bd467c9b90d1c58a59e27fbc6673cb68d855c72..0ef849cb84650705ffc840aed8a3fcedbeb48f9a 100644 (file)
@@ -205,6 +205,8 @@ static void *run(void *arg)
 
                work_done(w);
        }
+       free_grep_patterns(arg);
+       free(arg);
 
        return (void*) (intptr_t) hit;
 }