Module Name: src Committed By: christos Date: Thu Jan 21 17:17:53 UTC 2016
Modified Files: src/sys/dev/stbi: stb_image.c Log Message: PR/50686: David Binderman: fix memory leak To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/dev/stbi/stb_image.c:1.8 --- src/sys/dev/stbi/stb_image.c:1.7 Thu Jan 21 12:16:48 2016 +++ src/sys/dev/stbi/stb_image.c Thu Jan 21 12:17:53 2016 @@ -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.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 @@ static stbi_uc *bmp_load(stbi *s, int *x 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);