From 762dbcae6c2da1eda48c12e5aefe32a41e9fa37c Mon Sep 17 00:00:00 2001 From: "dp%netscape.com" Date: Fri, 9 Jul 1999 03:41:27 +0000 Subject: [PATCH] Fixed - Mismatched alloc/free - Guarded against null pointer and crash bug#8830 git-svn-id: svn://10.0.0.236/trunk@38872 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsFileSpec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mozilla/xpcom/io/nsFileSpec.cpp b/mozilla/xpcom/io/nsFileSpec.cpp index 78768faf9d8..12a4847a79e 100644 --- a/mozilla/xpcom/io/nsFileSpec.cpp +++ b/mozilla/xpcom/io/nsFileSpec.cpp @@ -570,6 +570,7 @@ void nsFileURL::operator = (const nsFilePath& inOther) { mURL = kFileURLPrefix; char* original = (char*)(const char*)inOther; // we shall modify, but restore. + if (!original || !*original) return; #ifdef XP_PC // because we don't want to escape the '|' character, change it to a letter. NS_ASSERTION(original[2] == '|', "No drive letter part!"); @@ -819,7 +820,7 @@ void nsFileSpec::MakeUnique() } if (*suffix) nsCRT::free(suffix); - delete [] leafName; + nsCRT::free(leafName); } // nsFileSpec::MakeUnique //----------------------------------------------------------------------------------------