Fixed strings allocated with ToNewCString() that were either not disposed at all, either disposed with 'delete' instead of 'delete[]'. Thanks to Bruce Mitchener Jr. <bruce@cybersight.com>.

git-svn-id: svn://10.0.0.236/trunk@25515 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pierre%netscape.com 1999-03-30 00:40:04 +00:00
parent 2aa4e6e9e7
commit dc0110fe78
3 changed files with 13 additions and 7 deletions

View File

@ -164,7 +164,7 @@ PRBool nsFileWidget::Show()
NS_ASSERTION(0, "Only load and save are supported modes");
}
// Clean up filter buffers
delete filterBuffer;
delete[] filterBuffer;
if (!reply.sfGood) return PR_FALSE;

View File

@ -153,10 +153,11 @@ NS_METHOD nsMenu::GetLabel(nsString &aText)
NS_METHOD nsMenu::SetLabel(const nsString &aText)
{
mLabel = aText;
mMacMenuHandle = nsnull;
mMacMenuHandle = ::NewMenu(mMacMenuIDCount, c2pstr(mLabel.ToNewCString()));
char* menuLabel = mLabel.ToNewCString();
mMacMenuHandle = ::NewMenu(mMacMenuIDCount, c2pstr(menuLabel));
delete[] menuLabel;
mMacMenuID = mMacMenuIDCount;
mMacMenuIDCount++;
@ -200,8 +201,11 @@ NS_METHOD nsMenu::AddMenuItem(nsIMenuItem * aMenuItem)
nsString label;
aMenuItem->GetLabel(label);
char* menuLabel = label.ToNewCString();
mNumMenuItems++;
::InsertMenuItem(mMacMenuHandle, c2pstr(label.ToNewCString()), mNumMenuItems );
::InsertMenuItem(mMacMenuHandle, c2pstr(menuLabel), mNumMenuItems);
delete[] menuLabel;
return NS_OK;
}
@ -215,8 +219,10 @@ NS_METHOD nsMenu::AddMenu(nsIMenu * aMenu)
// We have to add it as a menu item and then associate it with the item
nsString label;
aMenu->GetLabel(label);
char* menuLabel = label.ToNewCString();
mNumMenuItems++;
::InsertMenuItem(mMacMenuHandle, c2pstr(label.ToNewCString()), mNumMenuItems);
::InsertMenuItem(mMacMenuHandle, c2pstr(menuLabel), mNumMenuItems);
delete[] menuLabel;
MenuHandle menuHandle;
aMenu->GetNativeData((void**)&menuHandle);

View File

@ -406,7 +406,7 @@ nsIImageRequest * nsImageButton::RequestImage(nsString aUrl)
//request->GetNaturalDimensions(&mImageWidth, &mImageHeight);
delete url;
delete[] url;
return request;
}