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.
<rdar://problem/7555330>
Created attachment 46958 [details] Patch
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.
(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 on attachment 46958 [details] Patch r=me
Landed in r53509.