freeMXF.org

Open discussion about freeMXF.org tools and MXF in general
It is currently Sat Dec 21, 2024 4:36 pm
Board index » MXF Categories » freeMXF.org Tools



Post new topic Reply to topic  [ 1 post ] 
Author
Search for:
Message

Offline
Board User

Joined: Fri Feb 12, 2010 8:28 am
Posts: 6

Post Posted: Wed Mar 03, 2010 4:05 pm 
Top  
I just noticed GCWriter::AddEssenceData() leaks memory if called more than once per stream without a prior call to GCWriter::Flush(). The culprit is the fact that all variants of the function allocate a buffer (UInt8 *Buffer) that isn't freed when/if WriteQueue.insert() fails.
The solution is simple: before allocating Buffer check whether WriteQueue already has an entry for the current stream. If so, bail out:

Code:
if(WriteQueue.find(Stream->WriteOrder) != WriteQueue.end())
    return;

// Set up a new buffer big enough for the key, a huge BER length and the data
UInt8 *Buffer = new UInt8[(size_t)(16 + 9 + Size)];


Could probably use some kind of error message, but otherwise shuts valgrind up.

 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

Jump to:  


Who is online

Users browsing this forum: No registered users and 8 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group :: Style based on FI Subice by phpBBservice.nl :: All times are UTC