Correct memory leak in MediaConstraints
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2017 19:33:09 +0000 (19:33 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2017 19:33:09 +0000 (19:33 +0000)
commit61f3b53b6dda4c94346b508534abc537d7f1a016
tree5a44134feafb1648aa22de0896d916f7b41396d2
parent861622c956622cd53d1c2653b41b4da329843e20
Correct memory leak in MediaConstraints
https://bugs.webkit.org/show_bug.cgi?id=167744
<rdar://problem/30331444>

Reviewed by Anders Carlsson.

ConstraintHolder returns a reference to an object created by operator new. When the
returned value is assigned or stored in Vector or other containers we leak memory.
Instead, this value should just be returned as a regular object so that the return
value optimization can make sure memory is properly (and efficiently) used.

* platform/mediastream/MediaConstraints.h:
(WebCore::FlattenedConstraint::ConstraintHolder::create): Return by value.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/MediaConstraints.h