From 00219bd6ac3cfddaf767c0cad04a305cee2d2180 Mon Sep 17 00:00:00 2001 From: ruti <> Date: Tue, 6 Aug 2024 20:22:42 +0300 Subject: [PATCH] fix double free if hostslist is empty #44 --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 8abe6b3..19e0c2b 100644 --- a/main.c +++ b/main.c @@ -195,8 +195,11 @@ char *parse_cform(const char *str, ssize_t *size) } i--; p--; } - *size = i; char *m = realloc(d, i); + if (i == 0) { + return 0; + } + *size = i; return m ? m : d; }