Fix a leak in makeTypedArrayWithTemplate

RESOLVED FIXED in Firefox 51

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

(Blocks: 1 bug, {coverity})

Trunk
mozilla51
coverity
Points:
---

Firefox Tracking Flags

(firefox50 affected, firefox51 fixed)

Details

(Whiteboard: CID 1364094, CID 1364095, 1364096)

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
makeTypedArrayWithTemplate has a leak on an error path.
(Assignee)

Comment 1

2 years ago
Created attachment 8774163 [details] [diff] [review]
Fix a leak in an error path in makeTypedArrayWithTemplate
Attachment #8774163 - Flags: review?(jdemooij)
(Assignee)

Updated

2 years ago
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.
(Assignee)

Comment 3

2 years ago
> 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(); }

:(
(Assignee)

Updated

2 years ago
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+
(Assignee)

Comment 5

2 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d72e8e5f5ad18d9ded651ecb1adf7060023c103
Bug 1288985 - Fix a leak in an error path in makeTypedArrayWithTemplate. r=bbouvier.

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/3d72e8e5f5ad
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox51: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.