[vlc-commits] remap: use vlc_obj_malloc() and simplify

Rémi Denis-Courmont git at videolan.org
Fri Sep 25 15:53:45 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 25 16:27:51 2020 +0300| [4cb742715a6bb44fc94680c4f3f317a10926e9a5] | committer: Rémi Denis-Courmont

remap: use vlc_obj_malloc() and simplify

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4cb742715a6bb44fc94680c4f3f317a10926e9a5
---

 modules/audio_filter/channel_mixer/remap.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/modules/audio_filter/channel_mixer/remap.c b/modules/audio_filter/channel_mixer/remap.c
index a259939ba6..8c49a5f1ae 100644
--- a/modules/audio_filter/channel_mixer/remap.c
+++ b/modules/audio_filter/channel_mixer/remap.c
@@ -38,7 +38,6 @@
  * Module descriptor
  *****************************************************************************/
 static int  OpenFilter( vlc_object_t * );
-static void CloseFilter( vlc_object_t * );
 
 #define REMAP_CFG "aout-remap-"
 
@@ -75,7 +74,7 @@ vlc_module_begin ()
     set_capability( "audio filter", 0 )
     set_category( CAT_AUDIO )
     set_subcategory( SUBCAT_AUDIO_AFILTER )
-    set_callbacks( OpenFilter, CloseFilter )
+    set_callback( OpenFilter )
     set_shortname( "Remap" )
 
 #define CHANNEL( idx ) \
@@ -272,7 +271,7 @@ static int OpenFilter( vlc_object_t *p_this )
     audio_format_t *audio_out = &p_filter->fmt_out.audio;
 
     /* Allocate the memory needed to store the module's structure */
-    p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
+    p_sys = p_filter->p_sys = vlc_obj_malloc( p_this, sizeof(filter_sys_t) );
     if( unlikely( p_sys == NULL ) )
         return VLC_ENOMEM;
 
@@ -304,7 +303,6 @@ static int OpenFilter( vlc_object_t *p_this )
         if (val >= AOUT_CHAN_MAX)
         {
             msg_Err( p_filter, "invalid channel index" );
-            free( p_sys );
             return VLC_EGENERIC;
         }
         if (val < 0)
@@ -353,7 +351,6 @@ static int OpenFilter( vlc_object_t *p_this )
     if( !p_sys->pf_remap )
     {
         msg_Err( p_filter, "Could not decide on %s remap function", b_multiple ? "an add" : "a copy" );
-        free( p_sys );
         return VLC_EGENERIC;
     }
 
@@ -373,16 +370,6 @@ static int OpenFilter( vlc_object_t *p_this )
     return VLC_SUCCESS;
 }
 
-/*****************************************************************************
- * CloseFilter:
- *****************************************************************************/
-static void CloseFilter( vlc_object_t *p_this )
-{
-    filter_t *p_filter = (filter_t *) p_this;
-    filter_sys_t *p_sys = p_filter->p_sys;
-    free( p_sys );
-}
-
 /*****************************************************************************
  * Remap:
  *****************************************************************************/



More information about the vlc-commits mailing list