bug 645565 don't stomp previous 200 response with an invalid one, r=biesi
authorDaniel Veditz <dveditz@cruzio.com>
Mon, 11 Apr 2011 23:46:19 -0700
changeset 67992 5c1d236f0d5f4f55bb9fa4d04790bbe474e390bd
parent 67991 8a1136b1b6249b797107ce5e753ad25cd3b4407c
child 67993 8a67aa03761e68db2dd62a1dd3c20abc35638d7e
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbiesi
bugs645565
milestone2.2a1pre
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 645565 don't stomp previous 200 response with an invalid one, r=biesi
netwerk/streamconv/converters/nsDirIndexParser.cpp
--- a/netwerk/streamconv/converters/nsDirIndexParser.cpp
+++ b/netwerk/streamconv/converters/nsDirIndexParser.cpp
@@ -174,18 +174,16 @@ nsDirIndexParser::gFieldTable[] = {
 nsrefcnt nsDirIndexParser::gRefCntParser = 0;
 nsITextToSubURI *nsDirIndexParser::gTextToSubURI;
 
 nsresult
 nsDirIndexParser::ParseFormat(const char* aFormatStr) {
   // Parse a "200" format line, and remember the fields and their
   // ordering in mFormat. Multiple 200 lines stomp on each other.
 
-  delete[] mFormat;
-
   // Lets find out how many elements we have.
   // easier to do this then realloc
   const char* pos = aFormatStr;
   unsigned int num = 0;
   do {
     while (*pos && nsCRT::IsAsciiSpace(PRUnichar(*pos)))
       ++pos;
     
@@ -198,16 +196,17 @@ nsDirIndexParser::ParseFormat(const char
     if (! *pos)
       break;
 
     while (*pos && !nsCRT::IsAsciiSpace(PRUnichar(*pos)))
       ++pos;
 
   } while (*pos);
 
+  delete[] mFormat;
   mFormat = new int[num+1];
   // Prevent NULL Deref - Bug 443299 
   if (mFormat == nsnull)
     return NS_ERROR_OUT_OF_MEMORY;
   mFormat[num] = -1;
   
   int formatNum=0;
   do {