Bug 1031920 - Stop leaking mDataPtr on failure in ArrayBufferBuilder::getArrayBuffer. r=smaug

This commit is contained in:
Michael Shuen 2014-07-01 08:36:00 -04:00
parent 52e4297e97
commit 70a83130c9

View File

@ -4065,12 +4065,11 @@ ArrayBufferBuilder::getArrayBuffer(JSContext* aCx)
}
JSObject* obj = JS_NewArrayBufferWithContents(aCx, mLength, mDataPtr);
mDataPtr = nullptr;
mLength = mCapacity = 0;
if (!obj) {
js_free(mDataPtr);
return nullptr;
}
mDataPtr = nullptr;
return obj;
}