Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/stbi PR/46518: Nat Sloss: stbi splash: compressed PN...



details:   https://anonhg.NetBSD.org/src/rev/7f8747da1248
branches:  trunk
changeset: 779538:7f8747da1248
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 02 14:30:04 2012 +0000

description:
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

diffstat:

 sys/dev/stbi/stb_image.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r b23e04ba69b9 -r 7f8747da1248 sys/dev/stbi/stb_image.c
--- a/sys/dev/stbi/stb_image.c  Sat Jun 02 14:24:00 2012 +0000
+++ b/sys/dev/stbi/stb_image.c  Sat Jun 02 14:30:04 2012 +0000
@@ -430,7 +430,7 @@
 #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 @@
 #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))



Home | Main Index | Thread Index | Old Index