]> git.ipfire.org Git - thirdparty/git.git/commit
diff: fix leaking orderfile option
authorPatrick Steinhardt <ps@pks.im>
Thu, 26 Sep 2024 11:46:29 +0000 (13:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Sep 2024 15:25:35 +0000 (08:25 -0700)
commit76c7e708bbd6b19856d1ffa58f720e8da0c9eb0f
treecb654faac69e30663cb56788ff0644b2feefdf40
parent49af1b772222673759756048344b142544d39849
diff: fix leaking orderfile option

The `orderfile` diff option is being assigned via `OPT_FILENAME()`,
which assigns an allocated string to the variable. We never free it
though, causing a memory leak.

Change the type of the string to `char *` and free it to plug the leak.
This also requires us to use `xstrdup()` to assign the global config to
it in case it is set.

This leak is being hit in t7621, but plugging it alone does not make the
test suite pass.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
combine-diff.c
diff.c
diff.h