Commit b7fb71e3 by Vicent Marti

notes: Use `git__strndup`

parent 2e1e0f10
...@@ -313,7 +313,6 @@ static int note_new( ...@@ -313,7 +313,6 @@ static int note_new(
git_blob *blob) git_blob *blob)
{ {
git_note *note = NULL; git_note *note = NULL;
git_buf note_contents = GIT_BUF_INIT;
note = (git_note *)git__malloc(sizeof(git_note)); note = (git_note *)git__malloc(sizeof(git_note));
GITERR_CHECK_ALLOC(note); GITERR_CHECK_ALLOC(note);
...@@ -324,8 +323,8 @@ static int note_new( ...@@ -324,8 +323,8 @@ static int note_new(
git_signature_dup(&note->committer, git_commit_committer(commit)) < 0) git_signature_dup(&note->committer, git_commit_committer(commit)) < 0)
return -1; return -1;
git_buf_put(&note_contents, git_blob_rawcontent(blob), git_blob_rawsize(blob)); note->message = git__strndup(git_blob_rawcontent(blob), git_blob_rawsize(blob));
note->message = git_buf_detach(&note_contents); GITERR_CHECK_ALLOC(note->message);
*out = note; *out = note;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment