summaryrefslogtreecommitdiff
path: root/src/diff_patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/diff_patch.c')
-rw-r--r--src/diff_patch.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/diff_patch.c b/src/diff_patch.c
index ec4979a52..0628da6f2 100644
--- a/src/diff_patch.c
+++ b/src/diff_patch.c
@@ -325,9 +325,14 @@ static int diff_binary(git_diff_output *output, git_patch *patch)
old_data, old_len, new_data, new_len)) < 0)
return error;
- return giterr_set_after_callback_function(
+ error = giterr_set_after_callback_function(
output->binary_cb(patch->delta, &binary, output->payload),
"git_patch");
+
+ git__free((char *) binary.old_file.data);
+ git__free((char *) binary.new_file.data);
+
+ return error;
}
static int diff_patch_generate(git_patch *patch, git_diff_output *output)
@@ -377,6 +382,9 @@ static void diff_patch_free(git_patch *patch)
git__free((char *)patch->diff_opts.old_prefix);
git__free((char *)patch->diff_opts.new_prefix);
+ git__free((char *)patch->binary.old_file.data);
+ git__free((char *)patch->binary.new_file.data);
+
if (patch->flags & GIT_DIFF_PATCH_ALLOCATED)
git__free(patch);
}