Skip to content

Commit 613381f

Browse files
committed
patch_parse: fix memory leak
1 parent 24b2182 commit 613381f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/patch_parse.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,8 +1014,10 @@ git_patch_parse_ctx *git_patch_parse_ctx_init(
10141014
return NULL;
10151015

10161016
if (content_len) {
1017-
if ((ctx->content = git__malloc(content_len)) == NULL)
1017+
if ((ctx->content = git__malloc(content_len)) == NULL) {
1018+
git__free(ctx);
10181019
return NULL;
1020+
}
10191021

10201022
memcpy((char *)ctx->content, content, content_len);
10211023
}

0 commit comments

Comments
 (0)