From 823b81363a1145de4b8660153007b11faf4e2c56 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Thu, 2 Jun 2022 02:43:58 -0700 Subject: web: fix minor mem leaks and bugs --- web/web_misc.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'web/web_misc.c') diff --git a/web/web_misc.c b/web/web_misc.c index a754f9e..dcb386e 100644 --- a/web/web_misc.c +++ b/web/web_misc.c @@ -27,3 +27,11 @@ char *bufstr_flush(bufstr *b) b->fl = b->buf; return b->fl; } + +void bufstr_clear(bufstr *b) +{ + if (b->buf != b->fl) + free(b->buf); + free(b->fl); + b->fl = b->buf = NULL; +} -- cgit v1.2.3-70-g09d2