avformat/tee: Fix leaks in tee muxer when open_slave fails
authorJan Sebechlebsky <sebechlebskyjan@gmail.com>
Wed, 20 Apr 2016 17:21:03 +0000 (20:21 +0300)
committerMarton Balint <cus@passwd.hu>
Fri, 22 Apr 2016 17:49:50 +0000 (19:49 +0200)
commitf9d7e9feec2a0fd7f7930d01876a70a9b8a4a3b9
treed3468a98fd30e8a000e214cf99255713e25f0130
parent27adf9f9cdbc6f1dc0a1292dc97490eec6f2f068
avformat/tee: Fix leaks in tee muxer when open_slave fails

In open_slave 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.

Some cleanups are made by Marton Balint.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/tee.c