Closed Bug 676180 Opened 9 years ago Closed 9 years ago

memory allocation / deallocation mismatch in toolkit/system/gnome/nsGIOService.cpp

Categories

(Toolkit :: General, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: david.volgyes, Assigned: david.volgyes)

References

Details

(Keywords: memory-leak)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110622232440

Steps to reproduce:

I run cppcheck 1.49 on the latest source, and I found several bugs.
This is one of them.


Actual results:

Memory was allocated with strdup(), and freed with g_free.
strdup uses malloc() and that causes a memory allocation/deallocation mismatch.


Expected results:

g_strdup should be used, as in the attached files you can see.
Keywords: mlk
Product: Firefox → Toolkit
QA Contact: general → general
Attachment #550298 - Flags: review?(karlt)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment on attachment 550298 [details] [diff] [review]
proposed solution.

Thanks!  In future patches can you include function names and 8 lines of context, please?  Mercurial can be configured to do this automatically as in the diff section here:
https://developer.mozilla.org/en/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3f
Attachment #550298 - Flags: review?(karlt) → review+
http://hg.mozilla.org/mozilla-central/rev/3a754c19cacd
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Blocks: cppcheck
Assignee: nobody → david.volgyes
Whiteboard: [inbound]
You need to log in before you can comment on or make changes to this bug.