mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-25 06:10:35 +00:00
plugged a memory leak in GetCString().
This commit is contained in:
parent
05f8b8e443
commit
01f1e066fb
@ -1131,10 +1131,13 @@ const char* nsFileSpec::GetCString() const
|
||||
{
|
||||
if (mPath.IsEmpty())
|
||||
{
|
||||
const_cast<nsFileSpec*>(this)->mPath
|
||||
= MacFileHelpers::PathNameFromFSSpec(mSpec, true);
|
||||
if (mPath.IsEmpty())
|
||||
char* path = MacFileHelpers::PathNameFromFSSpec(mSpec, true);
|
||||
if (path != NULL) {
|
||||
const_cast<nsFileSpec*>(this)->mPath = path; // operator =() copies the string!!!
|
||||
delete[] path;
|
||||
} else {
|
||||
const_cast<nsFileSpec*>(this)->mError = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
return mPath;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user