[vlc-commits] autodel: use vlc_obj_malloc(), check for errors
Rémi Denis-Courmont
git at videolan.org
Sun Apr 19 13:17:31 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 19 14:07:29 2020 +0300| [45088e24c7e5c269913626cfade96625820972b1] | committer: Rémi Denis-Courmont
autodel: use vlc_obj_malloc(), check for errors
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45088e24c7e5c269913626cfade96625820972b1
---
modules/stream_out/autodel.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/modules/stream_out/autodel.c b/modules/stream_out/autodel.c
index 866dd2134f..2fec6ab0ed 100644
--- a/modules/stream_out/autodel.c
+++ b/modules/stream_out/autodel.c
@@ -124,9 +124,10 @@ static int Send( sout_stream_t *p_stream, void *_p_es, block_t *p_buffer )
static int Open( vlc_object_t *p_this )
{
sout_stream_t *p_stream = (sout_stream_t*)p_this;
- sout_stream_sys_t *p_sys;
+ sout_stream_sys_t *p_sys = vlc_obj_malloc(p_this, sizeof (*p_sys));
- p_sys = malloc( sizeof( sout_stream_sys_t ) );
+ if (unlikely(p_sys == NULL))
+ return VLC_ENOMEM;
p_sys->pp_es = NULL;
p_sys->i_es_num = 0;
@@ -140,14 +141,6 @@ static int Open( vlc_object_t *p_this )
return VLC_SUCCESS;
}
-static void Close( vlc_object_t * p_this )
-{
- sout_stream_t *p_stream = (sout_stream_t*)p_this;
- sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
-
- free( p_sys );
-}
-
#define SOUT_CFG_PREFIX "sout-autodel-"
vlc_module_begin()
@@ -155,5 +148,5 @@ vlc_module_begin()
set_description(N_("Automatically add/delete input streams"))
set_capability("sout filter", 50)
add_shortcut("autodel")
- set_callbacks(Open, Close)
+ set_callback(Open)
vlc_module_end()
More information about the vlc-commits
mailing list