aboutsummaryrefslogtreecommitdiffstats
path: root/diff.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-26 13:46:29 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-27 08:25:35 -0700
commit76c7e708bbd6b19856d1ffa58f720e8da0c9eb0f (patch)
treecb654faac69e30663cb56788ff0644b2feefdf40 /diff.h
parentbuiltin/pull: fix leaking "ff" option (diff)
downloadgit-76c7e708bbd6b19856d1ffa58f720e8da0c9eb0f.tar.gz
git-76c7e708bbd6b19856d1ffa58f720e8da0c9eb0f.zip
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>
Diffstat (limited to 'diff.h')
-rw-r--r--diff.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/diff.h b/diff.h
index 9901c8ca8c..b95d3c1e83 100644
--- a/diff.h
+++ b/diff.h
@@ -235,7 +235,7 @@ enum diff_submodule_format {
* diffcore library with.
*/
struct diff_options {
- const char *orderfile;
+ char *orderfile;
/*
* "--rotate-to=<file>" would start showing at <file> and when