зеркало из https://github.com/mozilla/gecko-dev.git
111371 r/sr=bienvenu fix char* leaks when reading filenames from disk.
This commit is contained in:
Родитель
ad706350b0
Коммит
7faf639ae4
|
@ -234,7 +234,10 @@ nsMsgLocalMailFolder::CreateSubFolders(nsFileSpec &path)
|
||||||
for (nsDirectoryIterator dir(path, PR_FALSE); dir.Exists(); dir++) {
|
for (nsDirectoryIterator dir(path, PR_FALSE); dir.Exists(); dir++) {
|
||||||
nsFileSpec currentFolderPath = dir.Spec();
|
nsFileSpec currentFolderPath = dir.Spec();
|
||||||
|
|
||||||
nsMsgGetNativePathString(currentFolderPath.GetLeafName(),currentFolderNameStr);
|
char *leafName = currentFolderPath.GetLeafName();
|
||||||
|
nsMsgGetNativePathString(leafName, currentFolderNameStr);
|
||||||
|
PR_FREEIF(leafName);
|
||||||
|
|
||||||
if (nsShouldIgnoreFile(currentFolderNameStr))
|
if (nsShouldIgnoreFile(currentFolderNameStr))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -771,7 +774,11 @@ nsMsgLocalMailFolder::CheckIfFolderExists(const PRUnichar *folderName, nsFileSpe
|
||||||
for (nsDirectoryIterator dir(path, PR_FALSE); dir.Exists(); dir++)
|
for (nsDirectoryIterator dir(path, PR_FALSE); dir.Exists(); dir++)
|
||||||
{
|
{
|
||||||
nsFileSpec currentFolderPath = dir.Spec();
|
nsFileSpec currentFolderPath = dir.Spec();
|
||||||
nsMsgGetNativePathString(currentFolderPath.GetLeafName(),leafName);
|
|
||||||
|
char *leaf = currentFolderPath.GetLeafName();
|
||||||
|
nsMsgGetNativePathString(leaf,leafName);
|
||||||
|
PR_FREEIF(leaf);
|
||||||
|
|
||||||
if (!leafName.IsEmpty() &&
|
if (!leafName.IsEmpty() &&
|
||||||
Compare(nsDependentString(folderName), leafName,
|
Compare(nsDependentString(folderName), leafName,
|
||||||
nsCaseInsensitiveStringComparator()) == 0)
|
nsCaseInsensitiveStringComparator()) == 0)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче