Skip to content

Commit e579a5d

Browse files
committed
Merge branch 'mh/maint-notes-merge-pathbuf-fix'
* mh/maint-notes-merge-pathbuf-fix: notes_merge_commit(): do not pass temporary buffer to other function
2 parents bf604e6 + 8528445 commit e579a5d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

notes-merge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ int notes_merge_commit(struct notes_merge_options *o,
681681
* Finally store the new commit object SHA1 into 'result_sha1'.
682682
*/
683683
struct dir_struct dir;
684-
const char *path = git_path(NOTES_MERGE_WORKTREE "/");
684+
char *path = xstrdup(git_path(NOTES_MERGE_WORKTREE "/"));
685685
int path_len = strlen(path), i;
686686
const char *msg = strstr(partial_commit->buffer, "\n\n");
687687

@@ -721,6 +721,7 @@ int notes_merge_commit(struct notes_merge_options *o,
721721
result_sha1);
722722
OUTPUT(o, 4, "Finalized notes merge commit: %s",
723723
sha1_to_hex(result_sha1));
724+
free(path);
724725
return 0;
725726
}
726727

0 commit comments

Comments
 (0)