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

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


The p_sys can be released automatically with the module.
---
 modules/video_filter/deinterlace/deinterlace.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index 360dd5a61c9..9699ca3b129 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -473,23 +473,10 @@ int Mouse( filter_t *p_filter,
     return VLC_SUCCESS;
 }
 
-/*****************************************************************************
- * Close: clean up the filter
- *****************************************************************************/
-/**
- * Stops and uninitializes the filter, and deallocates memory.
- * @param p_this The filter instance as vlc_object_t.
- */
-static void Close( filter_t *p_filter )
-{
-    free( p_filter->p_sys );
-}
-
 static const struct vlc_filter_operations filter_ops = {
     .filter_video = Deinterlace,
     .flush = Flush,
     .video_mouse = Mouse,
-    .close = Close,
 };
 
 /*****************************************************************************
@@ -532,7 +519,7 @@ notsupp:
     assert( vlc_fourcc_IsYUV( fourcc ) );
 
     /* */
-    p_sys = p_filter->p_sys = malloc( sizeof( *p_sys ) );
+    p_sys = p_filter->p_sys = vlc_obj_malloc( VLC_OBJECT(p_filter), sizeof( *p_sys ) );
     if( !p_sys )
         return VLC_ENOMEM;
 
@@ -650,7 +637,7 @@ notsupp:
         ( fmt.i_chroma != p_filter->fmt_in.video.i_chroma ||
           fmt.i_height != p_filter->fmt_in.video.i_height ) )
     {
-        Close( p_filter );
+        vlc_obj_free( VLC_OBJECT(p_filter), p_sys );
         return VLC_EGENERIC;
     }
     p_filter->fmt_out.video = fmt;
-- 
2.26.2



More information about the vlc-devel mailing list