ffmpeg: fix memory leak if writer is initialized multiple times.
This commit is contained in:
parent
3cf5015980
commit
9a6a570ac9
@ -93,6 +93,7 @@ AVFormatWriter::StreamCookie::StreamCookie(AVFormatContext* context,
|
||||
|
||||
AVFormatWriter::StreamCookie::~StreamCookie()
|
||||
{
|
||||
// fStream is freed automatically when the codec context is closed
|
||||
}
|
||||
|
||||
|
||||
@ -392,6 +393,7 @@ AVFormatWriter::Init(const media_file_format* fileFormat)
|
||||
{
|
||||
TRACE("AVFormatWriter::Init()\n");
|
||||
|
||||
if (fIOContext == NULL) {
|
||||
uint8* buffer = static_cast<uint8*>(av_malloc(kIOBufferSize));
|
||||
if (buffer == NULL)
|
||||
return B_NO_MEMORY;
|
||||
@ -408,6 +410,7 @@ AVFormatWriter::Init(const media_file_format* fileFormat)
|
||||
|
||||
// Setup I/O hooks. This seems to be enough.
|
||||
fFormatContext->pb = fIOContext;
|
||||
}
|
||||
|
||||
// Set the AVOutputFormat according to fileFormat...
|
||||
fFormatContext->oformat = av_guess_format(fileFormat->short_name,
|
||||
|
Loading…
Reference in New Issue
Block a user