]> git.ipfire.org Git - thirdparty/git.git/commit
diff-lib: plug minor memory leaks in do_diff_cache()
authorRené Scharfe <l.s.r@web.de>
Sat, 14 Nov 2020 18:37:03 +0000 (19:37 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Nov 2020 21:45:42 +0000 (13:45 -0800)
commitd44e5267eaefb27521e4ed2655358b0282add239
tree12910a7e8118a5dda5c70722ffb74ca87c3a0691
parent898f80736c75878acc02dc55672317fcc0e0a5a6
diff-lib: plug minor memory leaks in do_diff_cache()

do_diff_cache() builds a struct rev_info to hand to diff_cache() from
scratch by initializing it using repo_init_revisions() and then
replacing its diffopt and prune_data members.

The diffopt member is initialized to a heap-allocated list of options,
though.  Release it using diff_setup_done() before overwriting it.

The initial value of the prune_data member doesn't need to be released,
but the copy created using copy_pathspec() does.  Clear it after use.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-lib.c