https://bugs.webkit.org/show_bug.cgi?id=172755
Reviewed by JF Bastien.
We were not properly freeing the list of dependencies if we were already tracking the promise before.
This is because addPendingPromise takes the list of dependencies as an rvalue-reference. In the case
where we were already tracking the promise we append the provided dependency list to the existing list.
Since we never bound or rvalue-ref to a non-temporary value we never destructed the Vector, leaking its
contents.
* runtime/PromiseDeferredTimer.cpp:
(JSC::PromiseDeferredTimer::addPendingPromise):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217608
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-05-31 Keith Miller <keith_miller@apple.com>
+
+ Fix leak in PromiseDeferredTimer
+ https://bugs.webkit.org/show_bug.cgi?id=172755
+
+ Reviewed by JF Bastien.
+
+ We were not properly freeing the list of dependencies if we were already tracking the promise before.
+ This is because addPendingPromise takes the list of dependencies as an rvalue-reference. In the case
+ where we were already tracking the promise we append the provided dependency list to the existing list.
+ Since we never bound or rvalue-ref to a non-temporary value we never destructed the Vector, leaking its
+ contents.
+
+ * runtime/PromiseDeferredTimer.cpp:
+ (JSC::PromiseDeferredTimer::addPendingPromise):
+
2017-05-30 Oleksandr Skachkov <gskachkov@gmail.com>
Prevent async methods named 'function' in Object literal
dependencies.append(Strong<JSCell>(*m_vm, ticket));
result.iterator->value = WTFMove(dependencies);
} else {
+ // We need to make sure we move dependencies into a non-reference type so we actually destruct it.
+ Vector<Strong<JSCell>> deps = WTFMove(dependencies);
dataLogLnIf(verbose, "Adding new dependencies for promise: ", RawPointer(ticket));
- result.iterator->value.appendVector(dependencies);
+ result.iterator->value.appendVector(deps);
}
#ifndef NDEBUG