diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-09-26 13:46:29 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-09-27 17:25:35 +0200 |
commit | 76c7e708bbd6b19856d1ffa58f720e8da0c9eb0f (patch) | |
tree | cb654faac69e30663cb56788ff0644b2feefdf40 /combine-diff.c | |
parent | builtin/pull: fix leaking "ff" option (diff) | |
download | git-76c7e708bbd6b19856d1ffa58f720e8da0c9eb0f.tar.xz 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 'combine-diff.c')
-rw-r--r-- | combine-diff.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/combine-diff.c b/combine-diff.c index 829a44e416..f6b624dc28 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1393,9 +1393,8 @@ static struct combine_diff_path *find_paths_generic(const struct object_id *oid, { struct combine_diff_path *paths = NULL; int i, num_parent = parents->nr; - int output_format = opt->output_format; - const char *orderfile = opt->orderfile; + char *orderfile = opt->orderfile; opt->output_format = DIFF_FORMAT_NO_OUTPUT; /* tell diff_tree to emit paths in sorted (=tree) order */ |