Bug 33770

Summary: dataFunctionMatrix leaks the array allocated by toArray
Product: WebKit Reporter: Mark Rowe (bdash) <mrowe>
Component: WebGLAssignee: Mark Rowe (bdash) <mrowe>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarrin, kbr, mrowe, webkit.review.bot
Priority: P2 Keywords: InRadar, Regression
Version: 528+ (Nightly build)   
Hardware: Macintosh   
OS: OS X 10.6   
URL: http://build.webkit.org/results/SnowLeopard%20Intel%20Leaks/r53371%20(3490)/DumpRenderTree-leaks.txt
Attachments:
Description Flags
Patch oliver: review+

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.