summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-07-20 18:08:40 +0100
committerGitHub <noreply@github.com>2019-07-20 18:08:40 +0100
commit1f44079cae42864cb51d98ca57f5d1f4d8296693 (patch)
tree4c0cc856971dda43c4c4e71fa7107b464c8e139f
parente07dbc92d113fbddd2a042b45ef1a01347492a4c (diff)
parenta613832ef35b2901896211c4c4eaeb31ed2b3cbc (diff)
downloadlibgit2-1f44079cae42864cb51d98ca57f5d1f4d8296693.tar.gz
Merge pull request #5179 from pks-t/pks/patch-parse-free
patch_parse: fix segfault due to line containing static contents
-rw-r--r--src/patch_parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 70c33ed7d..29dc8b818 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);