Fix leaking the IO context buffer when opening input fails.

The context buffer needs to be freed manually. This was already done
correctly in the destructor, but was missing from the error case.
This lead to a leak of at least 32K for the initial allocation or
potentially a lot more, depending on how much avformat_open_input
extended it for probing.

Change-Id: Ib4c751c7de9430926ae82b397803ac93ecfffe5d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2038
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
This commit is contained in:
Michael Lotz 2019-12-20 21:48:50 +01:00 committed by Stephan Aßmus
parent 1ae464b9cf
commit ca93f8fbc2
1 changed files with 1 additions and 0 deletions

View File

@ -266,6 +266,7 @@ StreamBase::Open()
TRACE("StreamBase::Open() - avformat_open_input() failed!\n");
// avformat_open_input() frees the context in case of failure
fContext = NULL;
av_free(fIOContext->buffer);
av_free(fIOContext);
fIOContext = NULL;
return B_NOT_SUPPORTED;