]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/blendbench.c
Fix memleak
[vlc] / modules / video_filter / blendbench.c
index 04d100f4194cd5acee014173f96d5b0793e57cff..e0302a269703b0c01c25e1c6bf270b331493068f 100644 (file)
@@ -29,7 +29,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_sout.h>
 #include <vlc_vout.h>
 
@@ -70,8 +71,8 @@ static picture_t *Filter( filter_t *, picture_t * );
 #define CFG_PREFIX "blendbench-"
 
 vlc_module_begin();
-    set_description( _("Blending benchmark filter") );
-    set_shortname( _("blendbench" ));
+    set_description( N_("Blending benchmark filter") );
+    set_shortname( N_("blendbench" ));
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VFILTER );
     set_capability( "video filter2", 0 );
@@ -97,7 +98,7 @@ vlc_module_begin();
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
-static const char *ppsz_filter_options[] = {
+static const char *const ppsz_filter_options[] = {
     "loops", "alpha", "base-image", "base-chroma", "blend-image",
     "blend-chroma", NULL
 };
@@ -176,6 +177,7 @@ static int Create( vlc_object_t *p_this )
     psz_temp = var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-chroma" );
     p_sys->i_base_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1],
                                        psz_temp[2], psz_temp[3] );
+    free( psz_temp );
     blendbench_LoadImage( p_this, &p_sys->p_base_image, p_sys->i_base_chroma,
                var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-image" ),
                "Base" );
@@ -184,6 +186,7 @@ static int Create( vlc_object_t *p_this )
                                            CFG_PREFIX "blend-chroma" );
     p_sys->i_blend_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1],
                                         psz_temp[2], psz_temp[3] );
+    free( psz_temp );
     blendbench_LoadImage( p_this, &p_sys->p_blend_image, p_sys->i_blend_chroma,
                var_CreateGetStringCommand( p_filter, CFG_PREFIX "blend-image" ),
                "Blend" );
@@ -199,8 +202,8 @@ static void Destroy( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys = p_filter->p_sys;
 
-    p_sys->p_base_image->pf_release( p_sys->p_base_image );
-    p_sys->p_blend_image->pf_release( p_sys->p_blend_image );
+    picture_Release( p_sys->p_base_image );
+    picture_Release( p_sys->p_blend_image );
 }
 
 /*****************************************************************************
@@ -214,10 +217,10 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     if( p_sys->b_done )
         return p_pic;
 
-    p_blend = vlc_object_create( p_filter, VLC_OBJECT_FILTER );
+    p_blend = vlc_object_create( p_filter, sizeof(filter_t) );
     if( !p_blend )
     {
-        p_pic->pf_release( p_pic );
+        picture_Release( p_pic );
         return NULL;
     }
     vlc_object_attach( p_blend, p_filter );
@@ -226,7 +229,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     p_blend->p_module = module_Need( p_blend, "video blending", 0, 0 );
     if( !p_blend->p_module )
     {
-        p_pic->pf_release( p_pic );
+        picture_Release( p_pic );
         vlc_object_detach( p_blend );
         vlc_object_release( p_blend );
         return NULL;