Closed Bug 1288985 Opened 8 years ago Closed 8 years ago

Fix a leak in makeTypedArrayWithTemplate

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox50 --- affected
firefox51 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1364094, CID 1364095, 1364096)

Attachments

(1 file)

makeTypedArrayWithTemplate has a leak on an error path.
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
Comment on attachment 8774163 [details] [diff] [review]
Fix a leak in an error path in makeTypedArrayWithTemplate

Review of attachment 8774163 [details] [diff] [review]:
-----------------------------------------------------------------

Apologies for the drive-by :)

::: js/src/vm/TypedArrayObject.cpp
@@ +630,5 @@
>          RootedObjectGroup group(cx, templateObj->group());
>  
>          NewObjectKind newKind = GenericObject;
>  
> +        ScopedJSFreePtr<void> buf;

IIRC, Scoped* pointers are deprecated in favor of mozilla::UniquePtr.
> IIRC, Scoped* pointers are deprecated in favor of mozilla::UniquePtr.

But UniquePtr<void> doesn't work:

> 0:05.44 ../../dist/include/mozilla/UniquePtr.h:317:4: error: cannot form a reference to 'void'
> 0:05.44   T& operator*() const { return *get(); }

:(
Attachment #8774163 - Flags: review?(jdemooij) → review?(bbouvier)
Comment on attachment 8774163 [details] [diff] [review]
Fix a leak in an error path in makeTypedArrayWithTemplate

Review of attachment 8774163 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thank you for the patch.
Attachment #8774163 - Flags: review?(bbouvier) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d72e8e5f5ad18d9ded651ecb1adf7060023c103
Bug 1288985 - Fix a leak in an error path in makeTypedArrayWithTemplate. r=bbouvier.
https://hg.mozilla.org/mozilla-central/rev/3d72e8e5f5ad
Status: ASSIGNED → 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

Created:
Updated:
Size: