commit 5a9f587bdc6c31930ea51b8dcf8a4b9d50468ed7
parent 45ab1a406e795a17f73efe6df198de6f978e15db
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 17 Feb 2026 17:50:18 +0900
commit: make author_email an owned copy
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/git/commit.c b/src/git/commit.c
@@ -21,7 +21,7 @@ struct GitCommit {
time_t commit_time;
int commit_timezone_offset;
char* author_name;
- const char* author_email;
+ char* author_email;
time_t author_time;
int author_timezone_offset;
GitDelta** deltas;
@@ -61,7 +61,7 @@ GitCommit* gitcommit_create(const git_oid* oid, git_repository* repo) {
// Get author info.
const git_signature* author = git_commit_author(commit->commit);
commit->author_name = author->name ? estrdup(author->name) : NULL;
- commit->author_email = author->email;
+ commit->author_email = author->email ? estrdup(author->email) : NULL;
commit->author_time = author->when.time;
commit->author_timezone_offset = author->when.offset;
@@ -143,6 +143,7 @@ void gitcommit_free(GitCommit* commit) {
free(commit->summary);
free(commit->message);
free(commit->author_name);
+ free(commit->author_email);
for (size_t i = 0; i < commit->deltas_len; i++) {
gitdelta_free(commit->deltas[i]);
commit->deltas[i] = NULL;