]> git.cameronkatri.com Git - cgit.git/commitdiff
Add cgit_free_commitinfo() and use where needed
authorLars Hjemli <hjemli@gmail.com>
Sat, 16 Dec 2006 13:58:20 +0000 (14:58 +0100)
committerLars Hjemli <hjemli@gmail.com>
Sat, 16 Dec 2006 13:58:20 +0000 (14:58 +0100)
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
cgit.h
shared.c
ui-commit.c
ui-log.c
ui-summary.c

diff --git a/cgit.h b/cgit.h
index f06a941d7ac1e01f6252ef29482ab1c5f3b24241..02cc26a4a4e698af4473572cb3ed0278e382e446 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -65,6 +65,8 @@ extern void cgit_global_config_cb(const char *name, const char *value);
 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,...);
 
 extern void html(const char *txt);
index 4574120cafa5c6900741dc0fbe83325d3f89eb72..b576df8496f3cdbc1767ae68b858ccf753896521 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -88,3 +88,13 @@ 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;
+}
index b441e143b3ac1daec60b3b416b14610aef82785e..f654208e187e5212c26826d943c3732682e098f9 100644 (file)
@@ -61,8 +61,5 @@ void cgit_print_commit(const char *hex)
        html("<div class='commit-msg'>");
        html_txt(info->msg);
        html("</div>");
-       free(info->author);
-       free(info->committer);
-       free(info->subject);
-       free(info);
+       cgit_free_commitinfo(info);
 }
index c52af79ac5ffb876bd4e41211fda907baa0f629b..b7da49fda6d239934e542bbc9d15f64c9d3ae07e 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -28,10 +28,7 @@ void print_commit(struct commit *commit)
        html("</td><td>");
        html_txt(info->author);
        html("</td></tr>\n");
-       free(info->author);
-       free(info->committer);
-       free(info->subject);
-       free(info);
+       cgit_free_commitinfo(info);
 }
 
 
index 8ff36425e99c7953a82f11b02c7e585d08890211..5ddeee328072ebd2c01c149bad3e7a926f4d7cac 100644 (file)
@@ -35,6 +35,7 @@ static int cgit_print_branch_cb(const char *refname, const unsigned char *sha1,
                html("</td><td>");
                html_txt(info->author);
                html("</td></tr>\n");
+               cgit_free_commitinfo(info);
        } else {
                html("<tr><td>");
                html_txt(buf);