Closed
Bug 211010
Opened 22 years ago
Closed 22 years ago
Memory leak of 576 bytes from 3 blocks allocated in PR_Malloc
Categories
(Core :: Graphics: ImageLib, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla1.5alpha
People
(Reporter: stephend, Assigned: Biesinger)
References
()
Details
(Keywords: memory-leak)
Attachments
(1 file)
1.29 KB,
patch
|
pavlov
:
review+
tor
:
superreview+
|
Details | Diff | Splinter Review |
Trunk build, Windows 2000.
Just doing -
-url http://www.3drealms.com/max/walkthrough/p3c4.html under Purify yields:
[W] MLK: Memory leak of 576 bytes from 3 blocks allocated in PR_Malloc
Distribution of leaked blocks
576 bytes from 3 blocks of 192 bytes (first block: 0x0c6e3140)
Allocation location
malloc [dbgheap.c:129]
PR_Malloc [prmem.c:474]
gif_write(gif_struct *,BYTE const*,UINT) [GIF2.cpp:955]
{
PRUint8 *map = gs->local_colormap;
if (!map) {
=> map = gs->local_colormap = (PRUint8*)PR_MALLOC(3 *
gs->local_colormap_size);
if (!map) {
gs->state = gif_oom;
break;
nsGIFDecoder2::ProcessData(BYTE *,UINT,UINT *) [nsGIFDecoder2.cpp:195]
// In the new decoder, we should always be able to process more data since
// we don't wait to decode each frame in an animation now.
if (gif_write_ready(mGIFStruct)) {
=> PRStatus result = gif_write(mGIFStruct, data, count);
if (result != PR_SUCCESS)
return NS_ERROR_FAILURE;
}
ReadDataOut [nsGIFDecoder2.cpp:137]
PRUint32 *writeCount)
{
nsGIFDecoder2 *decoder = NS_STATIC_CAST(nsGIFDecoder2*, closure);
=> nsresult rv = decoder->ProcessData((unsigned char*)fromRawSegment,
count, writeCount);
if (NS_FAILED(rv)) {
*writeCount = 0;
return rv;
nsInputStreamTee::WriteSegmentFun(nsIInputStream *,void *,char
const*,UINT,UINT,UINT *) [nsInputStreamTee.cpp:105]
{
nsInputStreamTee *tee = NS_REINTERPRET_CAST(nsInputStreamTee *,
closure);
=> nsresult rv = tee->mWriter(in, tee->mClosure, fromSegment, offset,
count, writeCount);
if (NS_FAILED(rv) || (*writeCount == 0)) {
NS_ASSERTION((NS_FAILED(rv) ? (*writeCount == 0) : PR_TRUE),
"writer returned an error with non-zero writeCount");
nsPipeInputStream::ReadSegments((*)(nsIInputStream *,void *,char
const*,UINT,UINT,UINT *),void *,UINT,UINT *) [nsPipe3.cpp:731]
while (segmentLen) {
writeCount = 0;
=> rv = writer(this, closure, segment, *readCount, segmentLen,
&writeCount);
if (NS_FAILED(rv) || (writeCount == 0)) {
count = 0;
nsInputStreamTee::ReadSegments((*)(nsIInputStream *,void *,char
const*,UINT,UINT,UINT *),void *,UINT,UINT *) [nsInputStreamTee.cpp:159]
mWriter = writer;
mClosure = closure;
=> return mSource->ReadSegments(WriteSegmentFun, this, count, bytesRead);
}
NS_IMETHODIMP
nsGIFDecoder2::WriteFrom(nsIInputStream *,UINT,UINT *) [nsGIFDecoder2.cpp:215]
/* unsigned long writeFrom (in nsIInputStream inStr, in unsigned long
count); */
NS_IMETHODIMP nsGIFDecoder2::WriteFrom(nsIInputStream *inStr, PRUint32
count, PRUint32 *_retval)
{
=> return inStr->ReadSegments(ReadDataOut, this, count, _retval);
}
imgRequest::OnDataAvailable(nsIRequest *,nsISupports *,nsIInputStream
*,UINT,UINT) [imgRequest.cpp:797]
}
PRUint32 wrote;
=> nsresult rv = mDecoder->WriteFrom(inStr, count, &wrote);
if (NS_FAILED(rv)) {
PR_LOG(gImgLog, PR_LOG_WARNING,
Assignee | ||
Comment 1•22 years ago
|
||
for some reason, someone was just assinging nsnull to local_colormap, without
freeing it. this patch changes it so that it does get freed. stephend confirmed
that this fixes the leak.
Reporter | ||
Updated•22 years ago
|
Summary: Memory leak of 576 bytes from 3 blocks allocated in PR_Malloc → Memory leak of 576 bytes from 3 blocks allocated in PR_Malloc
Assignee | ||
Comment 2•22 years ago
|
||
Comment on attachment 126689 [details] [diff] [review]
patch
this is a very short patch to just fix a leak in the gif decoder, introduced in
2001 by the checkin for bug 73978.
Attachment #126689 -
Flags: review?(pavlov)
Updated•22 years ago
|
Attachment #126689 -
Flags: review?(pavlov) → review+
Assignee | ||
Updated•22 years ago
|
Attachment #126689 -
Flags: superreview?(tor)
Attachment #126689 -
Flags: superreview?(tor) → superreview+
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.5alpha
Assignee | ||
Comment 3•22 years ago
|
||
Checking in nsGIFDecoder2.cpp;
/cvsroot/mozilla/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp,v <--
nsGIFDecoder2.cpp
new revision: 1.53; previous revision: 1.52
done
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•