Closed
Bug 678997
Opened 13 years ago
Closed 13 years ago
memory leak in widget/src/android/AndroidBridge.cpp
Categories
(Core Graveyard :: Widget: Android, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla9
People
(Reporter: david.volgyes, Assigned: dougt)
References
Details
(Keywords: memory-leak, mobile, Whiteboard: [MemShrink][good first bug][mentor=jdm])
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
dougt
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110622232440
Steps to reproduce:
cppcheck 1.49 (http://cppcheck.sourceforge.net/) found a plenty of potential null pointer dereference. This is one of them.
Actual results:
cppcheck tells everything:
widget/src/android/AndroidBridge.cpp:87]: (error) Allocation with strdup, putenv doesn't release it.
The corresponding line is that:
putenv(strdup("NSS_DISABLE_UNLOAD=1"));
Expected results:
I see that strdup should solve the "constness" problem.
However, you should release the memory after putenv.
char*tmp=strdup("NSS_DISABLE_UNLOAD=1");
putenv(tmp);
free(tmp);
This possible solution is attached.
Reporter | ||
Updated•13 years ago
|
Version: 5 Branch → Trunk
Updated•13 years ago
|
Component: General → Widget: Android
Product: Firefox → Core
QA Contact: general → android
Updated•13 years ago
|
Attachment #553182 -
Flags: review?(blassey.bugs)
Assignee | ||
Updated•13 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 1•13 years ago
|
||
Comment on attachment 553182 [details] [diff] [review]
AndroidBridge.diff
Review of attachment 553182 [details] [diff] [review]:
-----------------------------------------------------------------
::: widget/src/android/AndroidBridge.cpp
@@ +85,5 @@
> * Conveniently, NSS has an env var that can prevent it from unloading.
> */
> + char* tmp=strdup("NSS_DISABLE_UNLOAD=1");
> + putenv(tmp);
> + free(tmp);
how about this?
static char* nss_disable_unload = "NSS_DISABLE_UNLOAD=1";
putenv(nss_disable_unload);
Attachment #553182 -
Flags: review?(blassey.bugs)
Reporter | ||
Comment 2•13 years ago
|
||
Nice. Faster and safer.
Updated•13 years ago
|
Updated•13 years ago
|
Whiteboard: [MemShrink]
Updated•13 years ago
|
Assignee: nobody → david.volgyes
Comment 3•13 years ago
|
||
It would be nice for someone to pick this up. All that needs to be done is modify the patch to follow Brad's suggestion in comment 1.
Whiteboard: [MemShrink] → [MemShrink][good first bug][mentor=jdm]
Comment 4•13 years ago
|
||
Unassigning from David per his request (bug 679610 comment 4).
For anyone looking at this bug, feel free to take it, David has very kindly provided a patch, but will not have time to follow it through.
Assignee: david.volgyes → nobody
Whiteboard: [MemShrink][good first bug][mentor=jdm] → [MemShrink][good first bug][mentor=jdm][has patch, needs new assignee]
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → doug.turner
Assignee | ||
Comment 5•13 years ago
|
||
Attachment #553182 -
Attachment is obsolete: true
Attachment #557213 -
Flags: review?(azakai)
Comment 6•13 years ago
|
||
Wouldn't just removing the strdup work here?
Assignee | ||
Comment 7•13 years ago
|
||
that work work too. r+ w/ that change?
Comment 8•13 years ago
|
||
Yes.
Assignee | ||
Comment 9•13 years ago
|
||
Updated•13 years ago
|
Whiteboard: [MemShrink][good first bug][mentor=jdm][has patch, needs new assignee] → [MemShrink][good first bug][mentor=jdm]
Comment 10•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Assignee | ||
Updated•13 years ago
|
Attachment #557213 -
Flags: review?(azakai) → review+
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•