public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error
@ 2016-02-22  4:10 Simon Glass
  2016-02-22  4:10 ` [U-Boot] [PATCH 2/2] video: freetype: Fix a memory leak with a bad parameter Simon Glass
  2016-02-22 13:43 ` [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error Anatolij Gustschin
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2016-02-22  4:10 UTC (permalink / raw)
  To: u-boot

When the resolution is not supported we should free the memory we don't plan
to use.

Reported-by: Coverity (CID: 135127)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/video/console_truetype.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index c249f04..e16f95a 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -289,6 +289,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y,
 		}
 #endif
 		default:
+			free(data);
 			return -ENOSYS;
 		}
 
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/2] video: freetype: Fix a memory leak with a bad parameter
  2016-02-22  4:10 [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error Simon Glass
@ 2016-02-22  4:10 ` Simon Glass
  2016-02-22 13:44   ` Anatolij Gustschin
  2016-02-22 13:43 ` [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error Anatolij Gustschin
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2016-02-22  4:10 UTC (permalink / raw)
  To: u-boot

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>
---

 drivers/video/stb_truetype.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/video/stb_truetype.h b/drivers/video/stb_truetype.h
index 91d8e6f..26e483c 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;
    }
 
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error
  2016-02-22  4:10 [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error Simon Glass
  2016-02-22  4:10 ` [U-Boot] [PATCH 2/2] video: freetype: Fix a memory leak with a bad parameter Simon Glass
@ 2016-02-22 13:43 ` Anatolij Gustschin
  1 sibling, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2016-02-22 13:43 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, 21 Feb 2016 21:10:25 -0700
Simon Glass sjg at chromium.org wrote:

> When the resolution is not supported we should free the memory we don't plan
> to use.
> 
> Reported-by: Coverity (CID: 135127)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  drivers/video/console_truetype.c | 1 +

appied to u-boot-video/master, thanks1

--
Anatolij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/2] video: freetype: Fix a memory leak with a bad parameter
  2016-02-22  4:10 ` [U-Boot] [PATCH 2/2] video: freetype: Fix a memory leak with a bad parameter Simon Glass
@ 2016-02-22 13:44   ` Anatolij Gustschin
  0 siblings, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2016-02-22 13:44 UTC (permalink / raw)
  To: u-boot

On Sun, 21 Feb 2016 21:10:26 -0700
Simon Glass sjg at chromium.org wrote:

> 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>
> ---
> 
>  drivers/video/stb_truetype.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

appied to u-boot-video/master, thanks1

--
Anatolij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-22 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22  4:10 [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error Simon Glass
2016-02-22  4:10 ` [U-Boot] [PATCH 2/2] video: freetype: Fix a memory leak with a bad parameter Simon Glass
2016-02-22 13:44   ` Anatolij Gustschin
2016-02-22 13:43 ` [U-Boot] [PATCH 1/2] video: truetype: Fix a memory leak on error Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox