Merge pull request #5179 from pks-t/pks/patch-parse-free patch_parse: fix segfault due to line containing static contents
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 70c33ed..29dc8b8 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -653,7 +653,7 @@ static int parse_hunk_body(
memset(line, 0x0, sizeof(git_diff_line));
- line->content = ctx->parse_ctx.line;
+ line->content = git__strdup(ctx->parse_ctx.line);
line->content_len = ctx->parse_ctx.line_len;
line->content_offset = ctx->parse_ctx.content_len - ctx->parse_ctx.remain_len;
line->origin = eof_for_origin(last_origin);