Closed Bug 1296258 Opened 8 years ago Closed 8 years ago

[Static Analysis][Resource Leak] In function ScaledFontBase::GetGlyphDesignMetrics

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1369114)

Attachments

(1 file)

The Static Analysis tool Coverity detected that pointer |options| is not freed after it looses it's scope.

In the following code |options| gets allocated:

>>      cairo_font_options_t *options = cairo_font_options_create();
>>      cairo_scaled_font_get_font_options(mScaledFont, options);
>>
>>      if (cairo_font_options_get_antialias(options) != CAIRO_ANTIALIAS_NONE) {
>>        if (cairo_scaled_font_get_type(mScaledFont) == CAIRO_FONT_TYPE_WIN32) {

After that no where till the end of it's scot it isn't cached so loosing it's scope it will leak memory.
Just FTR, it looks like this was introduced in bug 943626, which just landed for mozilla-51, so it doesn't affect existing releases.
Blocks: 943626
Comment on attachment 8782407 [details]
Bug 1296258 - prevent memory leak in ScaledFontBase::GetGlyphDesignMetrics.

https://reviewboard.mozilla.org/r/72596/#review71208
Attachment #8782407 - Flags: review?(jmuizelaar) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3748b7a5ea35
prevent memory leak in ScaledFontBase::GetGlyphDesignMetrics. r=jrmuizel
https://hg.mozilla.org/mozilla-central/rev/3748b7a5ea35
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: