aboutsummaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorSimon Glass2016-02-21 21:10:26 -0700
committerAnatolij Gustschin2016-02-22 14:41:22 +0100
commitd5b9d11cb61c9b50cc799fc00b4e7c3a26004538 (patch)
tree06b227f809ab680cf4dbe28f24cc2b524a66c797 /drivers/video
parentf6e75ba7fe220fdcf77c50d23a4f31ef828f75f5 (diff)
video: freetype: Fix a memory leak with a bad parameter
Make sure to free memory used when the scale facture is incorrect. Reported-by: Coverity (CID: 24068) Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/stb_truetype.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/video/stb_truetype.h b/drivers/video/stb_truetype.h
index 91d8e6f905c..26e483cf566 100644
--- a/drivers/video/stb_truetype.h
+++ b/drivers/video/stb_truetype.h
@@ -2426,7 +2426,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;
}