Bug 25928 - [Gtk] Several errors detected by cppcheck
Summary: [Gtk] Several errors detected by cppcheck
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-21 06:47 PDT by xxx
Modified: 2010-03-17 07:08 PDT (History)
4 users (show)

See Also:


Attachments
Fix for cross-platform (1.88 KB, patch)
2009-05-22 07:47 PDT, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description xxx 2009-05-21 06:47:31 PDT
cppcheck (http://cppcheck.wiki.sourceforge.net/) is greater for checking c++ code!

[./accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:63]: (all) Memory leak: fallbackCache
[./css/CSSParser.cpp:370]: (all) Memory leak: prop
[./css/CSSPrimitiveValue.cpp:79]: (all) Memory leak: colorValueCache
[./page/DOMWindow.cpp:610]: (all) Memory leak: timer
[./platform/graphics/chromium/FontCacheChromiumWin.cpp:231]: (all) Memory leak: fontNameMap
[./platform/graphics/chromium/FontCacheChromiumWin.cpp:294]: (all) Memory leak: fontCmapCache
[./platform/graphics/opentype/OpenTypeUtilities.cpp:375]: (all) Buffer overrun
[./platform/graphics/opentype/OpenTypeUtilities.cpp:384]: (all) Array index out of bounds
[./platform/graphics/opentype/OpenTypeUtilities.cpp:385]: (all) Array index out of bounds
[./platform/graphics/opentype/OpenTypeUtilities.cpp:386]: (all) Array index out of bounds
[./platform/graphics/opentype/OpenTypeUtilities.cpp:387]: (all) Array index out of bounds
[./platform/qt/FileSystemQt.cpp:126]: (all) Memory leak: temp
[./platform/qt/PasteboardQt.cpp:77]: (all) Memory leak: md
[./rendering/style/SVGRenderStyle.cpp:55]: (all) Memory leak: defaultStyle
Comment 1 Alexey Proskuryakov 2009-05-22 07:31:58 PDT
Some of these warnings are false alarms, but some are real.
Comment 2 Alexey Proskuryakov 2009-05-22 07:47:07 PDT
Created attachment 30581 [details]
Fix for cross-platform

This patch fixes all issues affecting cross-platform code (there was only one). Some platform issues look real, too, but I didn't feel qualified to fix them.

> [./css/CSSParser.cpp:370]: (all) Memory leak: prop

Fixed.

> [./css/CSSPrimitiveValue.cpp:79]: (all) Memory leak: colorValueCache
> [./page/DOMWindow.cpp:610]: (all) Memory leak: timer
> [./rendering/style/SVGRenderStyle.cpp:55]: (all) Memory leak: defaultStyle

These are false alarms.
Comment 3 Eric Seidel (no email) 2009-05-22 07:57:27 PDT
Comment on attachment 30581 [details]
Fix for cross-platform

I think the ChangeLog could be slightly clearer.  To state that specifically we would leak if we ever parsed UINT_MAX / sizeof(CSSProperty*) properties (aka ~ 1billion).

Looks great though.
Comment 4 Alexey Proskuryakov 2009-05-22 08:06:23 PDT
Comment on attachment 30581 [details]
Fix for cross-platform

Committed r44044, clearing review flag.
Comment 5 Alexey Proskuryakov 2009-05-22 08:08:03 PDT
FontCacheChromiumWin.cpp ones are also false alarms, so these are ones to be investigated by port maintainers:

[./accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:63]: (all) Memory leak:
fallbackCache
[./platform/graphics/opentype/OpenTypeUtilities.cpp:375]: (all) Buffer overrun
[./platform/graphics/opentype/OpenTypeUtilities.cpp:384]: (all) Array index out
of bounds
[./platform/graphics/opentype/OpenTypeUtilities.cpp:385]: (all) Array index out
of bounds
[./platform/graphics/opentype/OpenTypeUtilities.cpp:386]: (all) Array index out
of bounds
[./platform/graphics/opentype/OpenTypeUtilities.cpp:387]: (all) Array index out
of bounds
[./platform/qt/FileSystemQt.cpp:126]: (all) Memory leak: temp
[./platform/qt/PasteboardQt.cpp:77]: (all) Memory leak: md

Comment 6 Gustavo Noronha (kov) 2009-06-16 15:21:48 PDT
(In reply to comment #0)
> [./accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:63]: (all) Memory leak:
> fallbackCache

My reading of the code indicates this is a false-positive. fallbackCache is meant to be alive from the first call onwards (it's static).
Comment 7 Andreas Kling 2010-03-16 05:18:58 PDT
(In reply to comment #5)
> [./platform/qt/PasteboardQt.cpp:77]: (all) Memory leak: md

False positive - ownership is transferred in QClipboard::setMimeData()
Comment 8 Andreas Kling 2010-03-17 04:03:11 PDT
Actually, this is also a false positive:
[./platform/qt/FileSystemQt.cpp:126]: (all) Memory leak: temp

Removing Qt keyword.
Comment 9 Gustavo Noronha (kov) 2010-03-17 07:08:04 PDT
I think we can close this bug, then, since the only GTK+ one was also a false-positive. Thanks!