shithub: libmujs

Download patch

ref: 453d28fcc0fa9dcd35ecd0050d8cec395bb161f2
parent: 9dd965b679238e12d72d2ce6b07465dfb5a00a8a
author: Tor Andersson <tor.andersson@artifex.com>
date: Sun Aug 1 09:58:34 EDT 2021

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

--- a/regexp.c
+++ b/regexp.c
@@ -943,6 +943,10 @@
 
 static void *default_alloc(void *ctx, void *p, int n)
 {
+	if (n == 0) {
+		free(p);
+		return NULL;
+	}
 	return realloc(p, (size_t)n);
 }