Skip to content

transcode: encoder: fix crash with double free while using lavc encoder

Evgeny Pavlov requested to merge lucenticus/vlc:fix-double-free into master

This merge request fixes the double free from the issue #27551 (closed).

It seems that closing of encoder in transcode_encoder_video_close is not really needed, because the widely used idiom in VLC is the following (e.g. this code ):

    transcode_encoder_close( id->encoder );
    transcode_encoder_delete( id->encoder );

In transcode_encoder_delete function there is a vlc_encoder_Destroy function, which closes the encoder in this line

The only place where transcode_encoder_close is using without transcode_encoder_delete is this place: https://code.videolan.org/videolan/vlc/-/blob/master/modules/stream_out/transcode/video.c#L235 I'm not sure that this part of code is not needed transcode_encoder_delete too, so I would be happy to discuss this fix.

Merge request reports