]> git.sesse.net Git - vlc/blobdiff - modules/codec/png.c
lua/intf: Fix a memleak.
[vlc] / modules / codec / png.c
index 47a256d8a57815914717fe9fcb198ed93629b97b..2b04b965ea53f494e3c8b96cf360799506a1b1c3 100644 (file)
@@ -28,7 +28,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
 #include <vlc_vout.h>
@@ -56,7 +56,7 @@ static picture_t *DecodeBlock  ( decoder_t *, block_t ** );
 vlc_module_begin();
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_VCODEC );
-    set_description( _("PNG video decoder") );
+    set_description( N_("PNG video decoder") );
     set_capability( "decoder", 1000 );
     set_callbacks( OpenDecoder, CloseDecoder );
     add_shortcut( "png" );
@@ -79,10 +79,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
@@ -217,6 +214,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
     /* Decode picture */
     p_row_pointers = malloc( sizeof(png_bytep) * i_height );
+    if( !p_row_pointers )
+        goto error;
     for( i = 0; i < (int)i_height; i++ )
         p_row_pointers[i] = p_pic->p->p_pixels + p_pic->p->i_pitch * i;