scribo

Email-based phlog generator
git clone git://git.z3bra.org/scribo.git
Log | Files | Refs | README | LICENSE

commit 7f49155fea2cf3104dfa570f8a27e27bcbf111db
parent f39a076dbb3ce131f85784f323937f1c2ba08f67
Author: Willy Goiffon <dev@z3bra.org>
Date:   Sun, 20 Sep 2020 11:31:17 +0200

Release headers memory when program terminates

Diffstat:
Mscribo.c | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/scribo.c b/scribo.c @@ -39,6 +39,7 @@ char * sanitize(const char *); FILE *pipeout(const char *, FILE *); char * header(struct headers *, char *); struct hdr * saveheader(struct headers *, char *); +void freeheaders(struct headers *head); int parseheaders(FILE *, struct headers *); int verifyheaders(struct headers *); int write_8bit(FILE *, FILE *); @@ -129,6 +130,16 @@ saveheader(struct headers *head, char *line) return h; } +void +freeheaders(struct headers *head) +{ + struct hdr *h; + while ((h = SLIST_FIRST(head))) { + SLIST_REMOVE_HEAD(head, entries); + free(h); + } +} + int parseheaders(FILE *fp, struct headers *head) { @@ -366,5 +377,7 @@ main(int argc, char *argv[]) fclose(in); + freeheaders(&headers); + return 0; }