builtin/fast-export: fix leaking diff options
Before calling `handle_commit()` in a loop, we set `diffopt.no_free` such that its contents aren't getting freed inside of `handle_commit()`. We never unset that flag though, which means that the structure's allocated resources will ultimately leak. Fix this by unsetting the flag after the loop such that we release its resources via `release_revisions()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Aug 14, 2024 at 08:52 UTC
8ed4e96b5bcbd98e8d9f4593d53d8729280f47b9
1 file changed
+2
builtin/fast-export.c
+2
@@ -1278,9 +1278,11 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
1278
revs.diffopt.format_callback = show_filemodify;
1279
revs.diffopt.format_callback_data = &paths_of_changed_objects;
1280
revs.diffopt.flags.recursive = 1;
1281
+
1282
revs.diffopt.no_free = 1;
1283
while ((commit = get_revision(&revs)))
1284
handle_commit(commit, &revs, &paths_of_changed_objects);
1285
+ revs.diffopt.no_free = 0;
1286
1287
handle_tags_and_duplicates(&extra_refs);
1288
handle_tags_and_duplicates(&tag_refs);