From ff745bb2cd2e9ff3aaa2e907624d694f3d08b092 Mon Sep 17 00:00:00 2001 From: "bruce%cybersight.com" Date: Sun, 25 Apr 1999 13:27:36 +0000 Subject: [PATCH] Fix for calls to nsFileSpec::GetLeafName(). It allocates memory with strdup(), so use free() and not delete[]. --- mailnews/imap/src/nsImapMailFolder.cpp | 4 ++-- mailnews/local/src/nsLocalMailFolder.cpp | 4 ++-- rdf/datasource/src/nsFileSystemDataSource.cpp | 4 ++-- xpfe/AppCores/src/nsPrefsCore.cpp | 2 +- xpinstall/src/ScheduledTasks.cpp | 2 +- xpinstall/src/nsInstallFile.cpp | 4 ++-- xpinstall/src/nsInstallPatch.cpp | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index cdd48801344a..e6af77d37648 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -319,9 +319,9 @@ NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsIEnumerator* *result) PL_strcat(newLeafName, kDirExt); path->SetLeafName(newLeafName); if(folderName) - delete[] folderName; + nsCRT::free(folderName); if(newLeafName) - delete[] newLeafName; + nsCRT::free(newLeafName); #endif } diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index 02d36568d56b..14db2077eaa7 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -293,9 +293,9 @@ nsMsgLocalMailFolder::GetSubFolders(nsIEnumerator* *result) PL_strcat(newLeafName, kDirExt); path->SetLeafName(newLeafName); if(folderName) - delete[] folderName; + nsCRT::free(folderName); if(newLeafName) - delete[] newLeafName; + nsCRT::free(newLeafName); #endif } diff --git a/rdf/datasource/src/nsFileSystemDataSource.cpp b/rdf/datasource/src/nsFileSystemDataSource.cpp index 69939bee9771..9512f88ed099 100644 --- a/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -798,7 +798,7 @@ FileSystemDataSource::isVisible(const nsNativeFileSpec& file) { isVisible = PR_FALSE; } - delete []basename; + nsCRT::free(basename); } #endif @@ -863,7 +863,7 @@ FileSystemDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral **aResult) nsIRDFLiteral *literal; gRDFService->GetLiteral(name.GetUnicode(), &literal); *aResult = literal; - delete []basename; + nsCRT::free(basename); return NS_OK; } diff --git a/xpfe/AppCores/src/nsPrefsCore.cpp b/xpfe/AppCores/src/nsPrefsCore.cpp index 55b15980b770..ef3d9b750061 100644 --- a/xpfe/AppCores/src/nsPrefsCore.cpp +++ b/xpfe/AppCores/src/nsPrefsCore.cpp @@ -169,7 +169,7 @@ nsresult nsPrefsCore::InitializePrefsManager() oldPrefs.Copy(newParent); const char* oldName = oldPrefs.GetLeafName(); newPrefs = newParent + oldName; - delete [] oldName; + PL_strfree(oldName); newPrefs.Rename("prefs.js"); } } diff --git a/xpinstall/src/ScheduledTasks.cpp b/xpinstall/src/ScheduledTasks.cpp index ff6bd5987818..936592ecc73f 100644 --- a/xpinstall/src/ScheduledTasks.cpp +++ b/xpinstall/src/ScheduledTasks.cpp @@ -147,7 +147,7 @@ void ReplaceScheduledFiles(void) { char* leafName = targetFile.GetLeafName(); replaceFile.Rename(leafName); - delete [] leafName; + nsCRT::free(leafName); NR_RegDeleteEntry( reg, key, tmpfile ); } diff --git a/xpinstall/src/nsInstallFile.cpp b/xpinstall/src/nsInstallFile.cpp index 7e99be99bcd5..04bc017217ef 100644 --- a/xpinstall/src/nsInstallFile.cpp +++ b/xpinstall/src/nsInstallFile.cpp @@ -192,7 +192,7 @@ PRInt32 nsInstallFile::CompleteFileMove() char* leafName = mFinalFile->GetLeafName(); mExtracedFile->Rename(leafName); - delete [] leafName; + nsCRT::free(leafName); } else @@ -209,7 +209,7 @@ PRInt32 nsInstallFile::CompleteFileMove() char* leafName = mFinalFile->GetLeafName(); mExtracedFile->Rename(leafName); - delete [] leafName; + nsCRT::free(leafName); } else { diff --git a/xpinstall/src/nsInstallPatch.cpp b/xpinstall/src/nsInstallPatch.cpp index df9782504896..5fd421a5aa10 100644 --- a/xpinstall/src/nsInstallPatch.cpp +++ b/xpinstall/src/nsInstallPatch.cpp @@ -320,7 +320,7 @@ nsInstallPatch::NativeReplace(const nsFileSpec& oldfile, nsFileSpec& newFile) char* leafName = newFile.GetLeafName(); newFile.Rename(leafName); - delete [] leafName; + nsCRT::free(leafName); } return nsInstall::SUCCESS;