From fec847a56de8ba4a0364dbfa52ecd62946bde29c Mon Sep 17 00:00:00 2001 From: Bogdan Postelnicu Date: Wed, 24 Feb 2016 13:34:10 +0200 Subject: [PATCH] Bug 1250439 - preven memory leak in Classifier::GetLookupCache. r=gcp MozReview-Commit-ID: BlROMq9gFzj --- toolkit/components/url-classifier/Classifier.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toolkit/components/url-classifier/Classifier.cpp b/toolkit/components/url-classifier/Classifier.cpp index 2adae10967c..a4f928d119c 100644 --- a/toolkit/components/url-classifier/Classifier.cpp +++ b/toolkit/components/url-classifier/Classifier.cpp @@ -692,7 +692,7 @@ Classifier::GetLookupCache(const nsACString& aTable) } } - LookupCache *cache = new LookupCache(aTable, mStoreDirectory); + UniquePtr cache(new LookupCache(aTable, mStoreDirectory)); nsresult rv = cache->Init(); if (NS_FAILED(rv)) { return nullptr; @@ -704,8 +704,8 @@ Classifier::GetLookupCache(const nsACString& aTable) } return nullptr; } - mLookupCaches.AppendElement(cache); - return cache; + mLookupCaches.AppendElement(cache.get()); + return cache.release(); } nsresult