Diff options
Diffstat (limited to 'source/parsing.c')
| -rw-r--r-- | source/parsing.c | 27 |
1 file changed, 26 insertions, 1 deletion
diff --git a/source/parsing.c b/source/parsing.c index 5b6ea57..f684241 100644 --- a/source/parsing.c +++ b/source/parsing.c @@ -4,7 +4,8 @@ * the request path settles which repository and which page the request works * on. Commit and tag objects arrive as header lines, a blank line, and then * the message, so the readers here walk the headers, copy out the fields the - * pages need, and re-encode the message into the page encoding. + * pages need, and re-encode the message into the page encoding. The records + * they return are freed here too. */ #define USE_THE_REPOSITORY_VARIABLE @@ -233,6 +234,17 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) return info; } +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->msg); + free(info); +} + struct taginfo *cgit_parse_tag(struct tag *tag) { void *data; @@ -268,3 +280,16 @@ cleanup: free(data); return info; } + +void cgit_free_taginfo(struct taginfo *info) +{ + // NULL is accepted because cgit_parse_tag returns it for a tag object + // that cannot be read, and a ref left holding that still gets freed + // along with the rest of its list. + if (!info) + return; + free(info->tagger); + free(info->tagger_email); + free(info->msg); + free(info); +} |
