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)

ARM
Android
defect
Not set
normal

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)

Attached patch AndroidBridge.diff (obsolete) (deleted) — 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.
Version: 5 Branch → Trunk
Component: General → Widget: Android
Product: Firefox → Core
QA Contact: general → android
Attachment #553182 - Flags: review?(blassey.bugs)
Blocks: cppcheck
Status: UNCONFIRMED → NEW
Ever confirmed: true
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)
Nice. Faster and safer.
Keywords: mlk, mobile
OS: Linux → Android
Hardware: x86_64 → ARM
Whiteboard: [MemShrink]
Assignee: nobody → david.volgyes
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]
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: nobody → doug.turner
Attached patch patch v.2 (deleted) — Splinter Review
Attachment #553182 - Attachment is obsolete: true
Attachment #557213 - Flags: review?(azakai)
Wouldn't just removing the strdup work here?
that work work too. r+ w/ that change?
Yes.
Whiteboard: [MemShrink][good first bug][mentor=jdm][has patch, needs new assignee] → [MemShrink][good first bug][mentor=jdm]
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Attachment #557213 - Flags: review?(azakai) → review+
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: