range-diff: clear `other_arg` at end of function
authorDenton Liu <liu.denton@gmail.com>
Fri, 6 Dec 2019 20:16:31 +0000 (12:16 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2019 20:36:53 +0000 (12:36 -0800)
We were leaking memory by not clearing `other_arg` after we were done
using it. Clear it after we've finished using it.

Note that this isn't strictly necessary since the memory will be
reclaimed once the command exits. However, since we are releasing the
strbufs, we should also clear `other_arg` for consistency.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/range-diff.c

index 98acf35..d8a4670 100644 (file)
@@ -84,6 +84,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
        res = show_range_diff(range1.buf, range2.buf, creation_factor,
                              simple_color < 1, &diffopt, &other_arg);
 
+       argv_array_clear(&other_arg);
        strbuf_release(&range1);
        strbuf_release(&range2);