changeset 1515:66c75f6982e2

Plug some memory leaks in 64vw.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 May 2018 22:49:07 +0300
parents 61a5bbaf8d5c
children 530ce92c513f
files tools/64vw.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/64vw.c	Fri May 11 22:36:21 2018 +0300
+++ b/tools/64vw.c	Fri May 11 22:49:07 2018 +0300
@@ -362,6 +362,7 @@
 
             if (fmt == NULL || cimage == NULL)
             {
+                dmC64ImageFree(cimage);
                 dmErrorMsg("Probing could not find any matching image format. Perhaps try forcing a format via -f.\n");
                 goto fail;
             }
@@ -369,6 +370,7 @@
             // Create surface (we are lazy and ugly)
             if ((surf = SDL_CreateRGBSurface(SDL_SWSURFACE, cimage->width, cimage->height, 8, 0, 0, 0, 0)) == NULL)
             {
+                dmC64ImageFree(cimage);
                 dmErrorMsg("Could not allocate surface.\n");
                 goto exit;
             }
@@ -387,6 +389,8 @@
                 }
             }
 
+            dmC64ImageFree(cimage);
+
 fail:
             if (surf == NULL && (surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 200, 8, 0, 0, 0, 0)) == NULL)
             {