[FFmpeg-devel] [PATCH v4 2/3] avformat/tee: Fix leaks in tee muxer when open_slave fails
Marton Balint
cus at passwd.hu
Wed Apr 6 23:28:24 CEST 2016
On Mon, 4 Apr 2016, sebechlebskyjan at gmail.com wrote:
> From: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
>
> Calling close_slave in case error is to be returned from open_slave
> will free allocated resources.
>
> Since failure can happen before bsfs array is initialized,
> close_slave must check that bsfs is not NULL before accessing
> tee_slave->bsfs[i] element.
I noticed a problem. tee->nb_slaves is only assigned after opening all
slaves, so if any of the open_slave call fails, tee->nb_slaves will still
be 0, so no resources will get freed.
On the other hand, if you move the assignment before the open_slave loop,
you will also have to handle the case in close_slaves when tee_slave->avf
is null, or you have to increase tee->nb_slaves incrementally in the
loop...
Regards,
Marton
More information about the ffmpeg-devel
mailing list