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/50686: David Binderman: fix memory leak



details:   https://anonhg.NetBSD.org/src/rev/2e83ef1632a0
branches:  trunk
changeset: 813207:2e83ef1632a0
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 21 17:17:53 2016 +0000

description:
PR/50686: David Binderman: fix memory leak

diffstat:

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

diffs (24 lines):

diff -r 6a2511face08 -r 2e83ef1632a0 sys/dev/stbi/stb_image.c
--- a/sys/dev/stbi/stb_image.c  Thu Jan 21 17:16:48 2016 +0000
+++ b/sys/dev/stbi/stb_image.c  Thu Jan 21 17:17:53 2016 +0000
@@ -430,7 +430,7 @@
 #endif
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.7 2016/01/21 17:16:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.8 2016/01/21 17:17:53 christos Exp $");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -3358,7 +3358,10 @@
             easy = 2;
       }
       if (!easy) {
-         if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP");
+         if (!mr || !mg || !mb) {
+           FREE(out);
+           return epuc("bad masks", "Corrupt BMP");
+        }
          // right shift amt to put high bit in position #7
          rshift = high_bit(mr)-7; rcount = bitcount(mr);
          gshift = high_bit(mg)-7; gcount = bitcount(mr);



Home | Main Index | Thread Index | Old Index