summaryrefslogtreecommitdiff
path: root/src/patch_parse.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2016-11-15 16:28:10 +0100
committerGitHub <noreply@github.com>2016-11-15 16:28:10 +0100
commit0cd162be8887069823eb8e987be551fdd593c623 (patch)
treeb69f6d5fdc7de53a2e96a7bfe0c1975958cfb93e /src/patch_parse.c
parent1db3035d74a8f734d65b4e779d3e4b22cfd90ebb (diff)
parent613381fc1461514fdbb1518799bcee0345fdece6 (diff)
downloadlibgit2-0cd162be8887069823eb8e987be551fdd593c623.tar.gz
Merge pull request #4008 from pks-t/pks/sortedcache-fd-leak
sortedcache: plug leaked file descriptor
Diffstat (limited to 'src/patch_parse.c')
-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);
}