stb: ++safety.
authorHermet Park <hermetpark@gmail.com>
Tue, 9 Jul 2019 12:29:08 +0000 (21:29 +0900)
committerHermet Park <hermetpark@gmail.com>
Wed, 10 Jul 2019 01:59:36 +0000 (10:59 +0900)
make it safe not to leave potential dangling pointers.

src/vector/stb/stb_image.h

index b8ab0553749ed644847940cc7a2582610f3cad91..b27f26e3a3984b91d54a7449943ee84ee4d5edd1 100644 (file)
@@ -580,7 +580,8 @@ typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1];
 #ifndef STBI_MALLOC
 #define STBI_MALLOC(sz)           malloc(sz)
 #define STBI_REALLOC(p,newsz)     realloc(p,newsz)
-#define STBI_FREE(p)              free(p)
+#define STBI_FREE(p)              free(p); \
+                                  p = NULL
 #endif
 
 #ifndef STBI_REALLOC_SIZED