Skip to contentSkip to conversation

diff-lib: stop calling diff_setup_done() in do_diff_cache()

PATCH New René Scharfe 1 participant 1 message May 1, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 diff-lib: stop calling diff_setup_done() in do_diff_cache()

d44e5267ea (diff-lib: plug minor memory leaks in do_diff_cache(), 2020-11-14) added the call to diff_setup_done() to release the memory of the parseopt member of struct diff_options that repo_init_revisions() had allocated via repo_diff_setup() and prep_parse_options().

189e97bc4b (diff: remove parseopts member from struct diff_options, 2022-12-01) did away with that allocation; diff_setup_done() doesn't release any memory anymore. So stop calling this function on the blank diffopt member before it is overwritten, as this is no longer necessary.

---
 diff-lib.c | 1 -
 1 file changed, 1 deletion(-)
diff-lib.c +0 -1
index 683f11e509..12b1541478 100644
@@ -660,7 +660,6 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
 
 	repo_init_revisions(opt->repo, &revs, NULL);
 	copy_pathspec(&revs.prune_data, &opt->pathspec);
-	diff_setup_done(&revs.diffopt);
 	revs.diffopt = *opt;
 
 	if (diff_cache(&revs, tree_oid, NULL, 1))

--
2.44.0