changeset 35298:99e63193b542

Fix resource leaks when loading logo file in vf_remove_logo.
author reimar
date Sat, 10 Nov 2012 13:11:49 +0000
parents aeb77e5b1942
children 7b3815b8238d
files libmpcodecs/vf_remove_logo.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_remove_logo.c	Sat Nov 10 13:06:15 2012 +0000
+++ b/libmpcodecs/vf_remove_logo.c	Sat Nov 10 13:11:49 2012 +0000
@@ -510,7 +510,7 @@
   ungetc(c, f);
 }
 
-#define REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE(message) {mp_msg(MSGT_VFILTER, MSGL_ERR, message); return NULL;}
+#define REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE(message) {mp_msg(MSGT_VFILTER, MSGL_ERR, message); goto err_out;}
 
 /**
  * \brief Loads a raw pgm or ppm file into a newly created pgm_structure object.
@@ -568,8 +568,15 @@
       *write_position |= fgetc(input);
     }
   }
+  fclose(input);
 
   return new_pgm;
+
+err_out:
+  if (input)
+    fclose(input);
+  free(new_pgm);
+  return NULL;
 }
 
 /**