Closed Bug 678785 Opened 11 years ago Closed 11 years ago

resource leak (not closed directory) in gfx/thebes/gfxFT2FontList.cpp

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: david.volgyes, Assigned: atulagrwl)

References

Details

(Whiteboard: [good first bug][mentor=jdm])

Attachments

(1 file, 1 obsolete file)

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

Steps to reproduce:

Cppcheck found a resource leak in gfx/thebes/gfxFT2FontList.cpp
in gfxFT2FontList::FindFonts() method.






Actual results:

First of all, I think it's Android specific, because it is in a section wich begins with #elif defined(ANDROID).

In line #216 there is this:
 DIR *d = opendir("/system/fonts");

But nowhere is closed the directory.


Expected results:

You should close DIR *d, when it is not used anymore.
I have attached a proposed fix.
Attached patch My proposed fix. (obsolete) — Splinter Review
Assignee: nobody → david.volgyes
Component: General → Graphics
Product: Firefox → Core
QA Contact: general → thebes
Setting status to NEW
Status: UNCONFIRMED → NEW
Ever confirmed: true
Blocks: cppcheck
Attachment #552934 - Attachment is patch: true
Attachment #552934 - Flags: review?(jdaggett)
I think you want to include a null check there, i.e.

  if (d) {
    closedir(d);
  }
Whiteboard: [good first bug] [mentor=jdm]
(In reply to John Daggett (:jtd) from comment #3)
> I think you want to include a null check there, i.e.
> 
>   if (d) {
>     closedir(d);
>   }

Definitely. Thanks.
David, could you post a revised patch so I can review+ it?
Unassigning from David per his request (bug 679610 comment 4).

For anyone looking at this bug, feel free to request it be assigned to you, David has very kindly provided a patch, but will not have time to follow it through.
Assignee: david.volgyes → nobody
Whiteboard: [good first bug] [mentor=jdm] → [good first bug] [mentor=jdm] [has patch, needs new assignee]
Attached patch Updated PatchSplinter Review
Updated the patch
Assignee: nobody → atulagrwl
Attachment #552934 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #552934 - Flags: review?(jdaggett)
Attachment #557632 - Flags: review?(jdaggett)
Attachment #557632 - Flags: review?(jdaggett) → review+
Keywords: checkin-needed
Keywords: checkin-needed
Whiteboard: [good first bug] [mentor=jdm] [has patch, needs new assignee] → [good first bug][mentor=jdm][inbound]
http://hg.mozilla.org/mozilla-central/rev/120aedf2c84f
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][mentor=jdm][inbound] → [good first bug][mentor=jdm]
Target Milestone: --- → mozilla9
You need to log in before you can comment on or make changes to this bug.