Don't use realloc(p, 0) to mean free() in default regex allocator.

This commit is contained in:
Tor Andersson
2021-08-01 13:58:34 +02:00
parent 9dd965b679
commit 453d28fcc0

View File

@@ -943,6 +943,10 @@ void regfreex(void *(*alloc)(void *ctx, void *p, int n), void *ctx, Reprog *prog
static void *default_alloc(void *ctx, void *p, int n)
{
if (n == 0) {
free(p);
return NULL;
}
return realloc(p, (size_t)n);
}