From c5e288fe9221bc1a7cc500f69a2c9018587f5aa3 Mon Sep 17 00:00:00 2001 From: "putterman%netscape.com" Date: Fri, 16 Apr 1999 22:56:38 +0000 Subject: [PATCH] Fixes a memory leak. --- mailnews/local/src/nsLocalMailFolder.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index 79266430624..cd257894a2b 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -151,18 +151,23 @@ nsresult nsMsgLocalMailFolder::CreateSubFolders(nsFileSpec &path) { nsresult rv = NS_OK; - nsAutoString currentFolderName; + nsAutoString currentFolderNameStr; nsIMsgFolder *child; - + char *folderName; for (nsDirectoryIterator dir(path); dir.Exists(); dir++) { nsFileSpec currentFolderPath = (nsFileSpec&)dir; - currentFolderName = currentFolderPath.GetLeafName(); - if (nsShouldIgnoreFile(currentFolderName)) + folderName = currentFolderPath.GetLeafName(); + currentFolderNameStr = folderName; + if (nsShouldIgnoreFile(currentFolderNameStr)) + { + PL_strfree(folderName); continue; + } - AddSubfolder(currentFolderName, &child); + AddSubfolder(currentFolderNameStr, &child); NS_IF_RELEASE(child); + PL_strfree(folderName); } return rv; }