From b3653cc3f17a02fe249671624d950d716a4b0806 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Sun, 18 Jan 2015 21:17:49 +0100 Subject: [PATCH] fix double free (found by cppcheck) --- stb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stb.h b/stb.h index 4460516..bbd9379 100644 --- a/stb.h +++ b/stb.h @@ -10052,7 +10052,7 @@ char *stb_decompress_fromfile(char *filename, unsigned int *len) if (p == NULL) return NULL; if (p[0] != 0x57 || p[1] != 0xBc || p[2] || p[3]) { free(p); return NULL; } q = (char *) malloc(stb_decompress_length(p)+1); - if (!q) { free(p); free(p); return NULL; } + if (!q) { free(p); return NULL; } *len = stb_decompress((unsigned char *) q, p, n); if (*len) q[*len] = 0; free(p);