fix double free if hostslist is empty

#44
This commit is contained in:
ruti 2024-08-06 20:22:42 +03:00
parent 30a3b64a4d
commit 00219bd6ac

5
main.c
View File

@ -195,8 +195,11 @@ char *parse_cform(const char *str, ssize_t *size)
} }
i--; p--; i--; p--;
} }
*size = i;
char *m = realloc(d, i); char *m = realloc(d, i);
if (i == 0) {
return 0;
}
*size = i;
return m ? m : d; return m ? m : d;
} }