summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2016-12-26 22:13:35 +0100
committerEtienne Samson <samson.etienne@gmail.com>2017-01-13 21:48:20 +0100
commitb0014063b229132b358e56b40892807d1ee5df9d (patch)
treee35c9af3a7dca834cb08e6bd6c4acc8e64fc88b7
parent8a349bf2a1e7257a4f35599b3613d7953289dc88 (diff)
downloadlibgit2-b0014063b229132b358e56b40892807d1ee5df9d.tar.gz
patch: memory leak of patch.base.diff_opts.new|old_prefix
-rw-r--r--src/patch_generate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/patch_generate.c b/src/patch_generate.c
index 3559cc2b8..ab68f5801 100644
--- a/src/patch_generate.c
+++ b/src/patch_generate.c
@@ -451,8 +451,10 @@ int git_diff_foreach(
if (binary_cb || hunk_cb || data_cb) {
if ((error = patch_generated_init(&patch, diff, idx)) != 0 ||
- (error = patch_generated_load(&patch, &xo.output)) != 0)
+ (error = patch_generated_load(&patch, &xo.output)) != 0) {
+ git_patch_free(&patch.base);
return error;
+ }
}
if ((error = patch_generated_invoke_file_callback(&patch, &xo.output)) == 0) {