Closed GoogleCodeExporter closed 9 years ago
Looks right to me. Do you have a file that triggers this bug?
Original comment by dbyr...@gmail.com
on 12 May 2011 at 2:55
The m_pReadHintSample is created in rtphint.cpp:136 by calling the ReadSample
// read the desired hint sample into memory
ReadSample(
hintSampleId,
&m_pReadHintSample,
&m_readHintSampleSize,
&m_readHintTimestamp);
And in the read sample function it is allocated with malloc in mp4track.cpp:320
void MP4Track::ReadSample(
MP4SampleId sampleId,
uint8_t** ppBytes,
uint32_t* pNumBytes,
MP4Timestamp* pStartTime,
MP4Duration* pDuration,
MP4Duration* pRenderingOffset,
bool* pIsSyncSample,
bool* hasDependencyFlags,
uint32_t* dependencyFlags )
[...]
if (*ppBytes == NULL) {
*ppBytes = (uint8_t*)MP4Malloc(*pNumBytes);
bufferMalloc = true;
}
Then it is destroyed with delete instead of free in rtphint.cpp:127
delete m_pReadHintSample;
Don't know if it is important, but I was getting some random seg faults in
mp4v2 functions in my application and valgrind only complained about this. I
believe it is good to fix it anyway.
Original comment by sergio.g...@gmail.com
on 12 May 2011 at 3:10
I totally agree with your analysis. I just wanted to see it crash myself
before I committed a fix.
Original comment by dbyr...@gmail.com
on 12 May 2011 at 3:37
The crash was on another point of the library, but probably related to a memory
corruption elsewhere. I will post if I found anyway of replicate the bug.
Original comment by sergio.g...@gmail.com
on 12 May 2011 at 5:23
Agree; stuff allocated with MP4Malloc should always be free'd with MP4Free.
This change should be in r464. Thanks for the heads up--if you run across
anything else in valgrind, definitely let us know so we can take a look.
Thanks!
Original comment by kid...@gmail.com
on 14 May 2011 at 11:42
Original issue reported on code.google.com by
sergio.g...@gmail.com
on 12 May 2011 at 2:08