# HG changeset patch # User reimar # Date 1352553109 0 # Node ID 99e63193b5426b1cafaf33ca219b313239981b6a # Parent aeb77e5b1942e6fa455106821af3795d964d1e7f Fix resource leaks when loading logo file in vf_remove_logo. diff -r aeb77e5b1942 -r 99e63193b542 libmpcodecs/vf_remove_logo.c --- 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; } /**