Module Name:    src
Committed By:   christos
Date:           Sat Jun  2 14:30:04 UTC 2012

Modified Files:
        src/sys/dev/stbi: stb_image.c

Log Message:
PR/46518: Nat Sloss: stbi splash: compressed PNG file causes panic
Make the kernel FREE macro behave like the userland free(3), i.e. accept NULL


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/stbi/stb_image.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/stbi/stb_image.c
diff -u src/sys/dev/stbi/stb_image.c:1.2 src/sys/dev/stbi/stb_image.c:1.3
--- src/sys/dev/stbi/stb_image.c:1.2	Fri Jan 20 18:13:47 2012
+++ src/sys/dev/stbi/stb_image.c	Sat Jun  2 10:30:04 2012
@@ -430,7 +430,7 @@ extern int      stbi_gif_info_from_file 
 #endif
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.2 2012/01/20 23:13:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.3 2012/06/02 14:30:04 christos Exp $");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -446,7 +446,8 @@ __KERNEL_RCSID(0, "$NetBSD: stb_image.c,
 #ifdef _KERNEL
 #define	MALLOC(size)		malloc((size), M_TEMP, M_WAITOK)
 #define	REALLOC(ptr, size)	realloc((ptr), (size), M_TEMP, M_WAITOK)
-#define	FREE(ptr)		free((ptr), M_TEMP)
+#define	FREE(ptr) \
+    do { if (ptr) free((ptr), M_TEMP); } while (/*CONSTCOND*/0)
 #else
 #define	MALLOC(size)		malloc((size))
 #define	REALLOC(ptr, size)	realloc((ptr), (size))

Reply via email to