summaryrefslogtreecommitdiff
path: root/src/patch_parse.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-09-24 09:40:42 -0400
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:07 -0500
commit6278fbc5dd5467e3f66f31dc9c4bb4a1a3519ba5 (patch)
tree63ce316f43f7a18f56b1ede12db44edea0b5a2f5 /src/patch_parse.c
parentf941f035aea73aeda0093a85e514711d006cda22 (diff)
downloadlibgit2-6278fbc5dd5467e3f66f31dc9c4bb4a1a3519ba5.tar.gz
patch parsing: squash some memory leaks
Diffstat (limited to 'src/patch_parse.c')
-rw-r--r--src/patch_parse.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 25193b6b7..418ed1e0c 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -939,6 +939,10 @@ static void patch_parsed__free(git_patch *p)
git__free(patch->rename_new_path);
git__free(patch->old_path);
git__free(patch->new_path);
+ git_array_clear(patch->base.hunks);
+ git_array_clear(patch->base.lines);
+ git__free(patch->base.delta);
+ git__free(patch);
}
int git_patch_from_patchfile(
@@ -985,5 +989,8 @@ int git_patch_from_patchfile(
*out = &patch->base;
done:
+ if (error < 0)
+ patch_parsed__free(&patch->base);
+
return error;
}