bug 645565 don't stomp previous 200 response with an invalid one, r=biesi, a=clegnitto
authorDaniel Veditz <dveditz@cruzio.com>
Tue, 12 Apr 2011 01:08:06 -0700
changeset 35023 a661e51cc97757246df6e1ca6a5615ca7551a912
parent 35022 a7a241b581ad67daf7d32fccc028723759f2b68d
child 35024 d8a491705d6065337589a4039a3e250721841b3e
push id1875
push userdveditz@mozilla.com
push dateTue, 12 Apr 2011 08:10:29 +0000
reviewersbiesi, clegnitto
bugs645565
milestone1.9.2.17pre
bug 645565 don't stomp previous 200 response with an invalid one, r=biesi, a=clegnitto
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;
   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 {