Commit 77dea4ef authored by Adrien Maglo's avatar Adrien Maglo Committed by Jean-Baptiste Kempf

Fix a segfault : check the return value of x264_encoder_open().

According to x264 code, if it fails, it return NULL.
And with a first NULL parameter x264_encoder_headers() segfaults.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent f69af253
...@@ -1304,6 +1304,12 @@ static int Open ( vlc_object_t *p_this ) ...@@ -1304,6 +1304,12 @@ static int Open ( vlc_object_t *p_this )
/* Open the encoder */ /* Open the encoder */
p_sys->h = x264_encoder_open( &p_sys->param ); p_sys->h = x264_encoder_open( &p_sys->param );
if( p_sys->h == NULL )
{
msg_Err( p_enc, "cannot open x264 encoder" );
return VLC_EGENERIC;
}
/* alloc mem */ /* alloc mem */
p_sys->i_buffer = 4 * p_enc->fmt_in.video.i_width * p_sys->i_buffer = 4 * p_enc->fmt_in.video.i_width *
p_enc->fmt_in.video.i_height + 1000; p_enc->fmt_in.video.i_height + 1000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment