p_sys->i_buffer_out = 0;
p_context = avcodec_alloc_context3(p_codec);
+ if( unlikely(p_context == NULL) )
+ {
+ free( p_sys );
+ return VLC_ENOMEM;
+ }
p_sys->p_context = p_context;
p_sys->p_context->codec_id = p_sys->p_codec->id;
p_context->thread_type = 0;
{
msg_Warn( p_enc, "invalid size %ix%i", p_enc->fmt_in.video.i_visible_width,
p_enc->fmt_in.video.i_visible_height );
+ avcodec_free_context( &p_context );
free( p_sys );
return VLC_EGENERIC;
}
free( p_enc->fmt_out.p_extra );
av_free( p_sys->p_buffer );
av_free( p_sys->p_interleave_buf );
+ avcodec_free_context( &p_context );
free( p_sys );
return VLC_ENOMEM;
}
vlc_avcodec_lock();
avcodec_close( p_sys->p_context );
vlc_avcodec_unlock();
- av_free( p_sys->p_context );
+ avcodec_free_context( &p_sys->p_context );
av_free( p_sys->p_interleave_buf );