]> git.ipfire.org Git - thirdparty/git.git/commitdiff
grep: use object_array_clear() in cmd_grep()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 22 Oct 2021 08:55:40 +0000 (10:55 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 Oct 2021 17:45:25 +0000 (10:45 -0700)
Free the "struct object_array" before exiting. This makes grep tests
(e.g.  "t7815-grep-binary.sh") a bit happer under SANITIZE=leak.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c

index fd184c182a31675668bcc29c8d8722a2f0323c47..555b2ab6008fb3a6c095c4c3317f364619b6e503 100644 (file)
@@ -1196,6 +1196,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                run_pager(&opt, prefix);
        clear_pathspec(&pathspec);
        free_grep_patterns(&opt);
+       object_array_clear(&list);
        free_repos();
        return !hit;
 }