Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7fb71e

Browse files
committed
notes: Use git__strndup
1 parent 2e1e0f1 commit b7fb71e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/notes.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ static int note_new(
313313
git_blob *blob)
314314
{
315315
git_note *note = NULL;
316-
git_buf note_contents = GIT_BUF_INIT;
317316

318317
note = (git_note *)git__malloc(sizeof(git_note));
319318
GITERR_CHECK_ALLOC(note);
@@ -324,8 +323,8 @@ static int note_new(
324323
git_signature_dup(&note->committer, git_commit_committer(commit)) < 0)
325324
return -1;
326325

327-
git_buf_put(&note_contents, git_blob_rawcontent(blob), git_blob_rawsize(blob));
328-
note->message = git_buf_detach(&note_contents);
326+
note->message = git__strndup(git_blob_rawcontent(blob), git_blob_rawsize(blob));
327+
GITERR_CHECK_ALLOC(note->message);
329328

330329
*out = note;
331330
return 0;

0 commit comments

Comments
 (0)