{"thread":{"id":"61402","subject":"[PATCH] diff-lib: stop calling diff_setup_done() in do_diff_cache()","startedAt":"2024-05-01T10:26:23Z","lastAt":"2024-05-01T10:26:23Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"493828","messageId":"0e96c5a3-7b4d-4c6b-875e-d80e3eb07a00@web.de","threadId":"61402","inReplyTo":null,"subject":"[PATCH] diff-lib: stop calling diff_setup_done() in do_diff_cache()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2024-05-01T10:26:16Z","receivedAt":"2024-05-01T10:26:23Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"d44e5267ea (diff-lib: plug minor memory leaks in do_diff_cache(),\n2020-11-14) added the call to diff_setup_done() to release the memory\nof the parseopt member of struct diff_options that repo_init_revisions()\nhad allocated via repo_diff_setup() and prep_parse_options().\n\n189e97bc4b (diff: remove parseopts member from struct diff_options,\n2022-12-01) did away with that allocation; diff_setup_done() doesn't\nrelease any memory anymore.  So stop calling this function on the blank\ndiffopt member before it is overwritten, as this is no longer necessary.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n diff-lib.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/diff-lib.c b/diff-lib.c\nindex 683f11e509..12b1541478 100644\n--- a/diff-lib.c\n+++ b/diff-lib.c\n@@ -660,7 +660,6 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)\n\n \trepo_init_revisions(opt->repo, &revs, NULL);\n \tcopy_pathspec(&revs.prune_data, &opt->pathspec);\n-\tdiff_setup_done(&revs.diffopt);\n \trevs.diffopt = *opt;\n\n \tif (diff_cache(&revs, tree_oid, NULL, 1))\n--\n2.44.0\n"}]}