Bug 33770 - dataFunctionMatrix leaks the array allocated by toArray
Summary: dataFunctionMatrix leaks the array allocated by toArray
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.6
: P2 Normal
Assignee: Mark Rowe (bdash)
URL: http://build.webkit.org/results/SnowL...
Keywords: InRadar, Regression
Depends on:
Blocks:
 
Reported: 2010-01-17 03:02 PST by Mark Rowe (bdash)
Modified: 2010-01-19 16:59 PST (History)
4 users (show)

See Also:


Attachments
Patch (7.74 KB, patch)
2010-01-19 16:15 PST, Mark Rowe (bdash)
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rowe (bdash) 2010-01-17 03:02:29 PST
The call to toArray allocates an array and transfers ownership to the caller.  The array is not freed.

The interface of toArray seems quite error-prone. Even internally the implementation of toArray looks like it will leak memory when error conditions are hit.  It shouldn’t be working with raw pointers that have to be explicitly freed.  A Vector<T> seems like a reasonable fit for this sort of data.  If it’s not a good fit for some reason, then we have OwnPtr / PassOwnPtr to manage the lifetime of manually-allocated memory.
Comment 1 Mark Rowe (bdash) 2010-01-18 23:32:04 PST
<rdar://problem/7555330>
Comment 2 Mark Rowe (bdash) 2010-01-19 16:15:55 PST
Created attachment 46958 [details]
Patch
Comment 3 WebKit Review Bot 2010-01-19 16:22:20 PST
Attachment 46958 [details] did not pass style-queue:

Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp:593:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp:641:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp:687:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Total errors found: 3


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Mark Rowe (bdash) 2010-01-19 16:24:08 PST
(In reply to comment #3)
> Attachment 46958 [details] did not pass style-queue:
> 
> Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1
> WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp:593:  A case label should
> not be indented, but line up with its switch statement.  [whitespace/indent]
> [4]
> WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp:641:  A case label should
> not be indented, but line up with its switch statement.  [whitespace/indent]
> [4]
> WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp:687:  A case label should
> not be indented, but line up with its switch statement.  [whitespace/indent]
> [4]
> Total errors found: 3
> 
> 
> If any of these errors are false positives, please file a bug against
> check-webkit-style.

I'm not fixing any of these.  This code already did a terrible job of matching the style guidelines and fixing it all would result in it being impossible to see the substance of the change.
Comment 5 Oliver Hunt 2010-01-19 16:26:59 PST
Comment on attachment 46958 [details]
Patch

r=me
Comment 6 Mark Rowe (bdash) 2010-01-19 16:59:13 PST
Landed in r53509.