summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2014-11-21 17:38:55 +0100
committerVicent Marti <tanoku@gmail.com>2014-11-21 17:38:55 +0100
commitb7fb71e39cd48b61300647eec1e7dabab43da5af (patch)
tree86475991f21bdd097154db604677fa669e2d94f5
parent2e1e0f108f324719537bddd537099798e7d7449a (diff)
downloadlibgit2-b7fb71e39cd48b61300647eec1e7dabab43da5af.tar.gz
notes: Use `git__strndup`
-rw-r--r--src/notes.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/notes.c b/src/notes.c
index 9b0d4d5ac..4b15925fd 100644
--- a/src/notes.c
+++ b/src/notes.c
@@ -313,7 +313,6 @@ static int note_new(
git_blob *blob)
{
git_note *note = NULL;
- git_buf note_contents = GIT_BUF_INIT;
note = (git_note *)git__malloc(sizeof(git_note));
GITERR_CHECK_ALLOC(note);
@@ -324,8 +323,8 @@ static int note_new(
git_signature_dup(&note->committer, git_commit_committer(commit)) < 0)
return -1;
- git_buf_put(&note_contents, git_blob_rawcontent(blob), git_blob_rawsize(blob));
- note->message = git_buf_detach(&note_contents);
+ note->message = git__strndup(git_blob_rawcontent(blob), git_blob_rawsize(blob));
+ GITERR_CHECK_ALLOC(note->message);
*out = note;
return 0;