bug 645565 don't stomp previous 200 response with an invalid one, r=biesi, a=clegnitto
authorDaniel Veditz <dveditz@cruzio.com>
Tue, 29 Mar 2011 13:29:31 -0700
changeset 27387 7238621a4e1ff21cd972511126f326bcf24b6519
parent 27386 f3c3c092f18469111e89a08dbdb0371694fa960c
child 27388 15c9a0503705a6cade04c5b69f65d8bf8f1d6751
push id2709
push userdveditz@mozilla.com
push dateTue, 12 Apr 2011 08:15:27 +0000
reviewersbiesi, clegnitto
bugs645565
milestone1.9.1.19pre
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 {