summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h2
-rw-r--r--shared.c10
-rw-r--r--ui-commit.c5
-rw-r--r--ui-log.c5
-rw-r--r--ui-summary.c1
5 files changed, 15 insertions, 8 deletions
diff --git a/cgit.h b/cgit.h
index f06a941..02cc26a 100644
--- a/cgit.h
+++ b/cgit.h
@@ -66,4 +66,6 @@ extern void cgit_repo_config_cb(const char *name, const char *value);
extern void cgit_querystring_cb(const char *name, const char *value);
+extern void *cgit_free_commitinfo(struct commitinfo *info);
+
extern char *fmt(const char *format,...);
diff --git a/shared.c b/shared.c
index 4574120..b576df8 100644
--- a/shared.c
+++ b/shared.c
@@ -89,2 +89,12 @@ void cgit_querystring_cb(const char *name, const char *value)
}
+void *cgit_free_commitinfo(struct commitinfo *info)
+{
+ free(info->author);
+ free(info->author_email);
+ free(info->committer);
+ free(info->committer_email);
+ free(info->subject);
+ free(info);
+ return NULL;
+}
diff --git a/ui-commit.c b/ui-commit.c
index b441e14..f654208 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -62,7 +62,4 @@ void cgit_print_commit(const char *hex)
html_txt(info->msg);
html("</div>");
- free(info->author);
- free(info->committer);
- free(info->subject);
- free(info);
+ cgit_free_commitinfo(info);
}
diff --git a/ui-log.c b/ui-log.c
index c52af79..b7da49f 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -29,8 +29,5 @@ void print_commit(struct commit *commit)
html_txt(info->author);
html("</td></tr>\n");
- free(info->author);
- free(info->committer);
- free(info->subject);
- free(info);
+ cgit_free_commitinfo(info);
}
diff --git a/ui-summary.c b/ui-summary.c
index 8ff3642..5ddeee3 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -36,4 +36,5 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
html_txt(info->author);
html("</td></tr>\n");
+ cgit_free_commitinfo(info);
} else {
html("<tr><td>");