[vlc-devel] [PATCH 2/2] codec: x264: fix leak on error
Zhao Zhili
quinkblack at foxmail.com
Mon Aug 27 11:41:31 CEST 2018
---
modules/codec/x264.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 19eed66..0efd802 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -811,7 +811,7 @@ static int Open ( vlc_object_t *p_this )
#else
p_enc->fmt_out.i_codec = VLC_CODEC_H264;
#endif
- p_enc->p_sys = p_sys = malloc( sizeof( encoder_sys_t ) );
+ p_enc->p_sys = p_sys = vlc_obj_malloc( p_this, sizeof( encoder_sys_t ) );
if( !p_sys )
return VLC_ENOMEM;
@@ -847,6 +847,7 @@ static int Open ( vlc_object_t *p_this )
else
{
msg_Err( p_enc, "Only high-profiles and 10-bit are supported");
+ free( psz_profile );
return VLC_EGENERIC;
}
# endif
@@ -854,8 +855,8 @@ static int Open ( vlc_object_t *p_this )
# ifdef MODULE_NAME_IS_x26410b
else
{
- msg_Err( p_enc, "Only high-profiles and 10-bit are supported");
- return VLC_EGENERIC;
+ msg_Err( p_enc, "Only high-profiles and 10-bit are supported");
+ return VLC_EGENERIC;
}
# endif
free( psz_profile );
@@ -1583,6 +1584,4 @@ static void Close( vlc_object_t *p_this )
vlc_mutex_unlock( &pthread_win32_mutex );
#endif
-
- free( p_sys );
}
--
2.9.5
More information about the vlc-devel
mailing list