summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-11-15 13:33:05 +0100
committerPatrick Steinhardt <ps@pks.im>2016-11-15 13:33:05 +0100
commit613381fc1461514fdbb1518799bcee0345fdece6 (patch)
treee190f3086888ee63bdca221042ab798972891ab9
parent24b2182c5a77945bedbc5de0f1b4a9b6f5d27284 (diff)
downloadlibgit2-613381fc1461514fdbb1518799bcee0345fdece6.tar.gz
patch_parse: fix memory leak
-rw-r--r--src/patch_parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 7a4fe9f1a..f5275947d 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -1014,8 +1014,10 @@ git_patch_parse_ctx *git_patch_parse_ctx_init(
return NULL;
if (content_len) {
- if ((ctx->content = git__malloc(content_len)) == NULL)
+ if ((ctx->content = git__malloc(content_len)) == NULL) {
+ git__free(ctx);
return NULL;
+ }
memcpy((char *)ctx->content, content, content_len);
}