Bug 1183954, Don't leak nsStructuredCloneContainer (use of 'auto' is error prone), r=leak

This commit is contained in:
Olli Pettay 2015-08-02 12:34:26 +03:00
Родитель d3364c4ca1
Коммит a2c1faa15b
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -1972,7 +1972,8 @@ Notification::GetData(JSContext* aCx,
{
if (mData.isNull() && !mDataAsBase64.IsEmpty()) {
nsresult rv;
auto container = new nsStructuredCloneContainer();
nsRefPtr<nsStructuredCloneContainer> container =
new nsStructuredCloneContainer();
rv = container->InitFromBase64(mDataAsBase64, JS_STRUCTURED_CLONE_VERSION,
aCx);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -2008,7 +2009,8 @@ Notification::InitFromJSVal(JSContext* aCx, JS::Handle<JS::Value> aData,
if (!mDataAsBase64.IsEmpty() || aData.isNull()) {
return;
}
auto dataObjectContainer = new nsStructuredCloneContainer();
nsRefPtr<nsStructuredCloneContainer> dataObjectContainer =
new nsStructuredCloneContainer();
aRv = dataObjectContainer->InitFromJSVal(aData, aCx);
if (NS_WARN_IF(aRv.Failed())) {
return;
@ -2025,7 +2027,8 @@ void Notification::InitFromBase64(JSContext* aCx, const nsAString& aData,
}
// To and fro to ensure it is valid base64.
auto container = new nsStructuredCloneContainer();
nsRefPtr<nsStructuredCloneContainer> container =
new nsStructuredCloneContainer();
aRv = container->InitFromBase64(aData, JS_STRUCTURED_CLONE_VERSION,
aCx);
if (NS_WARN_IF(aRv.Failed())) {