Memory leak in GRE_GetGREPathWithProperties

RESOLVED INCOMPLETE

Status

()

Core
XPCOM
RESOLVED INCOMPLETE
9 years ago
7 years ago

People

(Reporter: zbychs, Assigned: zbychs)

Tracking

({memory-leak})

Trunk
mozilla1.9.3a1
memory-leak
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [MemShrink:P3], URL)

Attachments

(1 obsolete attachment)

(Assignee)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 4.0.20506) FBSMTWB
Build Identifier: mozilla-1.9.2

Memory allocated on line 171 of /xpcom/glue/nsGREGlue.cpp is never freed.

Reproducible: Always

Updated

9 years ago
Keywords: mlk
Version: unspecified → 1.9.2 Branch

Updated

9 years ago
Version: 1.9.2 Branch → Trunk
(Assignee)

Comment 1

9 years ago
Created attachment 413495 [details] [diff] [review]
Patch that eliminates the memory leak.
Attachment #413495 - Flags: review?(benjamin)

Updated

9 years ago
Attachment #413495 - Flags: review?(benjamin) → review+
Assignee: nobody → zbychs
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: checkin-needed
OS: Windows XP → All
Hardware: x86 → All
Comment on attachment 413495 [details] [diff] [review]
Patch that eliminates the memory leak.

Requesting approval1.9.2 for this memory leak fix.
Attachment #413495 - Flags: approval1.9.2?
http://hg.mozilla.org/mozilla-central/rev/3ba6cbcc8bef
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
nsGREGlue.cpp
/tools/gcc/bin/g++ -o nsGREGlue.o -c -I../../dist/system_wrappers -include /builds/slave/comm-central-trunk-linux/build/mozilla/config/gcc_hidden.h -DMOZ_SUITE=1 -DOSTYPE=\"Linux2.6.18-8\" -DOSARCH=Linux -DTARGET_XPCOM_ABI=\"x86-gcc3\" -I/builds/slave/comm-central-trunk-linux/build/mozilla/xpcom/glue/../build  -I/builds/slave/comm-central-trunk-linux/build/mozilla/xpcom/glue -I. -I../../dist/include -I../../dist/include/nsprpub  -I/builds/slave/comm-central-trunk-linux/build/objdir/mozilla/dist/include/nspr -I/builds/slave/comm-central-trunk-linux/build/objdir/mozilla/dist/include/nss       -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Wno-long-long -pedantic -gstabs+ -fno-strict-aliasing -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -Os -freorder-blocks -fno-reorder-functions -finline-limit=50   -DMOZILLA_CLIENT -include ../../mozilla-config.h -Wp,-MD,.deps/nsGREGlue.pp /builds/slave/comm-central-trunk-linux/build/mozilla/xpcom/glue/nsGREGlue.cpp
/builds/slave/comm-central-trunk-linux/build/objdir/mozilla/config/nsinstall -D ../../dist/sdk/lib
/builds/slave/comm-central-trunk-linux/build/mozilla/xpcom/glue/nsGREGlue.cpp: In function ‘nsresult GRE_GetGREPathWithProperties(const GREVersionRange*, PRUint32, const GREProperty*, PRUint32, char*, PRUint32)’:
/builds/slave/comm-central-trunk-linux/build/mozilla/xpcom/glue/nsGREGlue.cpp:171: error: no matching function for call to ‘nsAutoArrayPtr<GREProperty>::nsAutoArrayPtr(nsAutoArrayPtr<GREProperty>)’
../../dist/include/nsAutoPtr.h:554: note: candidates are: nsAutoArrayPtr<T>::nsAutoArrayPtr(nsAutoArrayPtr<T>&) [with T = GREProperty]
../../dist/include/nsAutoPtr.h:548: note:                 nsAutoArrayPtr<T>::nsAutoArrayPtr(T*) [with T = GREProperty]
/builds/slave/comm-central-trunk-linux/build/mozilla/xpcom/glue/nsGREGlue.cpp:171: error:   initializing temporary from result of ‘nsAutoArrayPtr<T>::nsAutoArrayPtr(T*) [with T = GREProperty]’
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #413495 - Attachment is obsolete: true
Attachment #413495 - Flags: approval1.9.2?

Comment 5

9 years ago
Comment on attachment 413495 [details] [diff] [review]
Patch that eliminates the memory leak.

>-  GREProperty *allProperties = new GREProperty[propertiesLength + 1];
>+  nsAutoArrayPtr<GREProperty> allProperties = new GREProperty[propertiesLength + 1];

You probably need to explicitly use the constructor form here, i.e.

nsAutoArrayPtr<GREProperty> allProperties(new GREProperty[propertiesLength + 1]);
Whiteboard: [MemShrink]
Ping?  The patch bounced and was never followed up.
Whiteboard: [MemShrink] → [MemShrink:P3]

Comment 7

7 years ago
The code in question has been removed.
Status: REOPENED → RESOLVED
Last Resolved: 9 years ago7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.