Skip to content

Commit b001406

Browse files
committed
patch: memory leak of patch.base.diff_opts.new|old_prefix
1 parent 8a349bf commit b001406

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/patch_generate.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,10 @@ int git_diff_foreach(
451451

452452
if (binary_cb || hunk_cb || data_cb) {
453453
if ((error = patch_generated_init(&patch, diff, idx)) != 0 ||
454-
(error = patch_generated_load(&patch, &xo.output)) != 0)
454+
(error = patch_generated_load(&patch, &xo.output)) != 0) {
455+
git_patch_free(&patch.base);
455456
return error;
457+
}
456458
}
457459

458460
if ((error = patch_generated_invoke_file_callback(&patch, &xo.output)) == 0) {

0 commit comments

Comments
 (0)