From 56e8fd063ce8105ba05884a540763068b744bf2f Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sat, 2 Apr 2016 03:55:03 -0700 Subject: [PATCH] don't leak vertex data if text is scaled to 0 --- stb_truetype.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stb_truetype.h b/stb_truetype.h index b24aa19..d59c37d 100644 --- a/stb_truetype.h +++ b/stb_truetype.h @@ -2435,7 +2435,10 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info if (scale_x == 0) scale_x = scale_y; 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; }