[vlc-devel] [PATCH 3/4] tospdif: remove unneeded Close callback

Steve Lhomme robux4 at ycbcr.xyz
Tue Oct 13 08:22:38 CEST 2020


The p_sys can be released automatically with the module.
---
 modules/audio_filter/converter/tospdif.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/modules/audio_filter/converter/tospdif.c b/modules/audio_filter/converter/tospdif.c
index 236d4a2f8b8..308ef09074b 100644
--- a/modules/audio_filter/converter/tospdif.c
+++ b/modules/audio_filter/converter/tospdif.c
@@ -596,15 +596,9 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
     return p_out_buf;
 }
 
-static void Close( filter_t *p_filter )
-{
-    free( p_filter->p_sys );
-}
-
 static int Open( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
-    filter_sys_t *p_sys;
 
     if( ( p_filter->fmt_in.audio.i_format != VLC_CODEC_DTS &&
           p_filter->fmt_in.audio.i_format != VLC_CODEC_DTSHD &&
@@ -616,15 +610,14 @@ static int Open( vlc_object_t *p_this )
           p_filter->fmt_out.audio.i_format != VLC_CODEC_SPDIFB ) )
         return VLC_EGENERIC;
 
-    p_sys = p_filter->p_sys = calloc( 1, sizeof(filter_sys_t) );
-    if( unlikely( p_sys == NULL ) )
+    p_filter->p_sys = vlc_obj_calloc( VLC_OBJECT(p_filter), 1, sizeof(filter_sys_t) );
+    if( unlikely( p_filter->p_sys == NULL ) )
         return VLC_ENOMEM;
 
     static const struct vlc_filter_operations filter_ops =
     {
         .filter_audio = DoWork,
         .flush = Flush,
-        .close = Close,
     };
     p_filter->ops = &filter_ops;
 
-- 
2.26.2



More information about the vlc-devel mailing list