[FFmpeg-devel] [PATCH v5 2/3] avformat/tee: Fix leaks in tee muxer when open_slave fails
Marton Balint
cus at passwd.hu
Thu Apr 14 01:09:17 CEST 2016
On Tue, 12 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.
>
> Slave muxer expects write_trailer to be called if it's
> write_header suceeded (so resources allocated in write_header
> are freed). Therefore if failure happens after successfull
> write_header call, we must ensure that write_trailer of
> that particular slave is called.
Hmm, I guess you are right, I see no other way freeing
resources allocated in write_header then calling write_trailer. It does
make the code a bit more complex, but I don't really see a way to make it
more simple.
So this looks good to me. Nicolas, any ideas improving this?
Thanks,
Marton
More information about the ffmpeg-devel
mailing list