Bug 1024801, part 1 - Free prefixArray if nsUrlClassifierPrefixSet::GetPrefixes returns an error. r=gcp
authorAndrew McCreight <continuation@gmail.com>
Thu, 26 Jun 2014 09:29:06 -0700
changeset 212973 11dccfc5d6c38a2f71f09ed54ba020de35dbdc92
parent 212972 06101c617d6af0d6d968a342b63ecbaee71ab2ae
child 212974 cc67c4e78d8d02cd5d67a400255cde0b714d187b
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgcp
bugs1024801
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1024801, part 1 - Free prefixArray if nsUrlClassifierPrefixSet::GetPrefixes returns an error. r=gcp
toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
@@ -150,16 +150,17 @@ nsUrlClassifierPrefixSet::GetPrefixes(ui
   uint32_t prefixCnt = 0;
 
   for (uint32_t i = 0; i < prefixIdxLength; i++) {
     uint32_t prefix = mIndexPrefixes[i];
     uint32_t start = mIndexStarts[i];
     uint32_t end = (i == (prefixIdxLength - 1)) ? mDeltas.Length()
                                                 : mIndexStarts[i + 1];
     if (end > mDeltas.Length() || (start > end)) {
+      nsMemory::Free(prefixArray);
       return NS_ERROR_FILE_CORRUPTED;
     }
 
     prefixArray[prefixCnt++] = prefix;
     for (uint32_t j = start; j < end; j++) {
       prefix += mDeltas[j];
       prefixArray[prefixCnt++] = prefix;
     }