On 04/07/2016 12:28 AM, Marton Balint wrote:

On Mon, 4 Apr 2016, sebechlebsky...@gmail.com wrote:

From: Jan Sebechlebsky <sebechlebsky...@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
Thanks, this is another thing I overlooked when I was splitting the changes in 3 commits. Actually in third patch tee->nb_slaves is assigned before open_slave loop. I'll fix it to have stable version after each single patch.

Have a nice day

Jan S.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to