Fix memory leak in Contrib/stb_truetype.h, stbtt_GetGlyphBitmapSubpixel

Leak was reported by Coverity Scan

Issue reported to stb project here:
https://github.com/nothings/stb/issues/251
This commit is contained in:
Ben Hymers 2016-03-13 22:57:17 +00:00
parent 2f382134d4
commit e1f297e4bf

View File

@ -2430,7 +2430,10 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
if (scale_x == 0) scale_x = scale_y; if (scale_x == 0) scale_x = scale_y;
if (scale_y == 0) { if (scale_y == 0) {
if (scale_x == 0) return NULL; if (scale_x == 0) {
STBTT_free(vertices, info->userdata);
return NULL;
}
scale_y = scale_x; scale_y = scale_x;
} }