diff --git a/mozilla/base/tests/PropertiesTest.cpp b/mozilla/base/tests/PropertiesTest.cpp index 484df199998..e95c56e05fa 100644 --- a/mozilla/base/tests/PropertiesTest.cpp +++ b/mozilla/base/tests/PropertiesTest.cpp @@ -120,6 +120,7 @@ main(int argc, char *argv[]) } char *value = v.ToNewCString(); cout << "\"" << i << "\"=\"" << value << "\"" << endl; + delete[] value; i++; } diff --git a/mozilla/editor/base/nsTextEditor.cpp b/mozilla/editor/base/nsTextEditor.cpp index e35b3bf62a1..2e03823fdce 100644 --- a/mozilla/editor/base/nsTextEditor.cpp +++ b/mozilla/editor/base/nsTextEditor.cpp @@ -658,7 +658,7 @@ static void WriteFromOstrstream(ostrstream& aIn, nsString& aOutputString) // in ostrstreams if you call the str() function // then you are responsible for deleting the string - delete strData; + delete[] strData; } #endif diff --git a/mozilla/gfx/src/nsDeviceContext.cpp b/mozilla/gfx/src/nsDeviceContext.cpp index f2dbfd5b8d8..71f7c7dfffe 100644 --- a/mozilla/gfx/src/nsDeviceContext.cpp +++ b/mozilla/gfx/src/nsDeviceContext.cpp @@ -87,7 +87,7 @@ DeviceContextImpl :: ~DeviceContextImpl() if (nsnull != mGammaTable) { - delete mGammaTable; + delete[] mGammaTable; mGammaTable = nsnull; } diff --git a/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp b/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp index b081fd4b006..666e5ccb788 100644 --- a/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/mozilla/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -863,7 +863,7 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode, ostream& a char* buffer = new char[size+1]; data.ToCString(buffer,size+1); aStream << buffer; - delete buffer; + delete[] buffer; } else { diff --git a/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp b/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp index 5591f68fa87..4dd2fb57960 100644 --- a/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp +++ b/mozilla/intl/locale/src/windows/nsIWin32LocaleImpl.cpp @@ -234,10 +234,11 @@ nsIWin32LocaleImpl::GetPlatformLocale(const nsString* locale,LCID* winLCID) { *winLCID = MAKELCID(language_list[i].lang_code,SORT_DEFAULT); + delete[] locale_string; return NS_OK; } } - + delete[] locale_string; return NS_ERROR_FAILURE; } diff --git a/mozilla/network/module/nsHttpUrl.cpp b/mozilla/network/module/nsHttpUrl.cpp index 1e6adb8f787..aa8e3376005 100644 --- a/mozilla/network/module/nsHttpUrl.cpp +++ b/mozilla/network/module/nsHttpUrl.cpp @@ -426,7 +426,7 @@ nsresult nsHttpUrlImpl::ParseURL(const nsString& aSpec, const nsIURL* aURL) if (!isAbsolute) { // relative spec if (nsnull == aURL) { - delete cSpec; + delete[] cSpec; NS_UNLOCK_INSTANCE(); return NS_ERROR_ILLEGAL_VALUE; @@ -447,7 +447,7 @@ nsresult nsHttpUrlImpl::ParseURL(const nsString& aSpec, const nsIURL* aURL) // Strip out old tail component and put in the new one char* dp = PL_strrchr(uFile, '/'); if (!dp) { - delete cSpec; + delete[] cSpec; NS_UNLOCK_INSTANCE(); return NS_ERROR_ILLEGAL_VALUE; } @@ -533,7 +533,7 @@ nsresult nsHttpUrlImpl::ParseURL(const nsString& aSpec, const nsIURL* aURL) } } } else { - delete cSpec; + delete[] cSpec; NS_UNLOCK_INSTANCE(); return NS_ERROR_ILLEGAL_VALUE; @@ -617,7 +617,7 @@ nsresult nsHttpUrlImpl::ParseURL(const nsString& aSpec, const nsIURL* aURL) } //printf("protocol='%s' host='%s' file='%s'\n", mProtocol, mHost, mFile); - delete cSpec; + delete[] cSpec; NS_UNLOCK_INSTANCE(); return NS_OK; diff --git a/mozilla/network/module/nsNetService.cpp b/mozilla/network/module/nsNetService.cpp index 7814161f7c0..15079661bf1 100644 --- a/mozilla/network/module/nsNetService.cpp +++ b/mozilla/network/module/nsNetService.cpp @@ -821,7 +821,7 @@ nsNetlibService::SetProxyHTTP(nsString& aProxyHTTP) { return NS_FALSE; csPort = nsSPort.ToNewCString(); if (!csPort) { - delete proxy; + delete[] proxy; return NS_FALSE; } @@ -833,8 +833,8 @@ nsNetlibService::SetProxyHTTP(nsString& aProxyHTTP) { if ( PREF_OK != PREF_SetIntPref(pref_proxyHttpPort, port) ) { rv = NS_FALSE; } - delete proxy; - delete csPort; + delete[] proxy; + delete[] csPort; NET_SelectProxyStyle(PROXY_STYLE_MANUAL); diff --git a/mozilla/network/module/nsNetStubs.cpp b/mozilla/network/module/nsNetStubs.cpp index 24eaab14a57..52facd77f3e 100644 --- a/mozilla/network/module/nsNetStubs.cpp +++ b/mozilla/network/module/nsNetStubs.cpp @@ -1139,7 +1139,7 @@ NET_I_XP_FileOpen(const char * name, XP_FileType type, const XP_FilePerm perm) rv = fileMgr->OpenFile( (aName ? aName : name), mode, &nsFp); if (aName) - delete aName; + delete[] aName; if (NS_OK != rv) { return NULL; } @@ -1275,7 +1275,7 @@ NET_I_XP_FileRemove(const char * name, XP_FileType type) rv = fileMgr->FileRemove((aName ? aName : name)); if (aName) - delete aName; + delete[] aName; if (rv != NS_OK) return -1; @@ -1305,16 +1305,19 @@ NET_I_XP_Stat(const char * name, XP_StatStruct * info, XP_FileType type) if (!fileMgr) { if (NS_NewINetFile(&fileMgr, nsnull) != NS_OK) { + delete[] newName; return NULL; } } rv = fileMgr->GetFilePath(newName, &path); - if (rv != NS_OK) + if (rv != NS_OK) { + delete[] newName; return -1; + } status = PR_GetFileInfo(path, &fileInfo); PR_Free(path); - delete newName; + delete[] newName; if (status == PR_SUCCESS) { // transfer the pr stat info over to the xp stat object. // right now just moving over the size. diff --git a/mozilla/network/module/tests/nettest.cpp b/mozilla/network/module/tests/nettest.cpp index e68b72d2556..b22e9042f3f 100644 --- a/mozilla/network/module/tests/nettest.cpp +++ b/mozilla/network/module/tests/nettest.cpp @@ -134,7 +134,7 @@ NS_IMETHODIMP TestConsumer::OnStatus(nsIURL* aURL, const PRUnichar* aMsg) nsAutoString str(aMsg); char* c = str.ToNewCString(); fputs(c, stdout); - free(c); + delete[] c; fputs("\n", stdout); } diff --git a/mozilla/network/module/tests/transportTest.cpp b/mozilla/network/module/tests/transportTest.cpp index 5bea0a95f48..6d120bd2e1b 100644 --- a/mozilla/network/module/tests/transportTest.cpp +++ b/mozilla/network/module/tests/transportTest.cpp @@ -220,7 +220,7 @@ NS_IMETHODIMP TestConsumer::OnStatus(nsIURL* aURL, const PRUnichar* aMsg) nsString str(aMsg); char* c = str.ToNewCString(); fputs(c, stdout); - free(c); + delete[] c; fputs("\n", stdout); } diff --git a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp index b081fd4b006..666e5ccb788 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLContentSinkStream.cpp @@ -863,7 +863,7 @@ void nsHTMLContentSinkStream::AddStartTag(const nsIParserNode& aNode, ostream& a char* buffer = new char[size+1]; data.ToCString(buffer,size+1); aStream << buffer; - delete buffer; + delete[] buffer; } else { diff --git a/mozilla/webshell/src/nsComFactory.cpp b/mozilla/webshell/src/nsComFactory.cpp index 00b09fb8f07..c5e8728935a 100644 --- a/mozilla/webshell/src/nsComFactory.cpp +++ b/mozilla/webshell/src/nsComFactory.cpp @@ -303,7 +303,7 @@ STDAPI DllRegisterServer(void) // Free up memory... if (WebShellCLSID) { - delete WebShellCLSID; + delete[] WebShellCLSID; } return NOERROR; @@ -373,7 +373,7 @@ STDAPI DllUnregisterServer(void) // Free up memory... if (WebShellCLSID) { - delete WebShellCLSID; + delete[] WebShellCLSID; } return NOERROR; diff --git a/mozilla/widget/public/nsStringUtil.h b/mozilla/widget/public/nsStringUtil.h index 5cadae4c96a..16319bb7bbc 100644 --- a/mozilla/widget/public/nsStringUtil.h +++ b/mozilla/widget/public/nsStringUtil.h @@ -47,7 +47,7 @@ #define NS_FREE_STR_BUF(varName) \ if (! _ns_smallBufUsed) \ - delete varName; + delete[] varName; // Create temporary char[] macro // @@ -73,7 +73,7 @@ #define NS_FREE_CHAR_BUF(aBuf) \ if (! _ns_smallBufUsed) \ - delete aBuf; + delete[] aBuf; #endif // NSStringUtil diff --git a/mozilla/widget/src/photon/nsStringUtil.h b/mozilla/widget/src/photon/nsStringUtil.h index 4925500ba78..16319bb7bbc 100644 --- a/mozilla/widget/src/photon/nsStringUtil.h +++ b/mozilla/widget/src/photon/nsStringUtil.h @@ -47,7 +47,7 @@ #define NS_FREE_STR_BUF(varName) \ if (! _ns_smallBufUsed) \ - delete varName; + delete[] varName; // Create temporary char[] macro // @@ -73,7 +73,7 @@ #define NS_FREE_CHAR_BUF(aBuf) \ if (! _ns_smallBufUsed) \ - delete aBuf; + delete[] aBuf; -#endif // NSStringUtil \ No newline at end of file +#endif // NSStringUtil diff --git a/mozilla/widget/src/windows/nsFileWidget.cpp b/mozilla/widget/src/windows/nsFileWidget.cpp index e43cd1d2d3e..09a81303ff8 100644 --- a/mozilla/widget/src/windows/nsFileWidget.cpp +++ b/mozilla/widget/src/windows/nsFileWidget.cpp @@ -92,11 +92,11 @@ PRBool nsFileWidget::Show() VERIFY(::GetCurrentDirectory(MAX_PATH, newCurrentDirectory) > 0); mDisplayDirectory.SetLength(0); mDisplayDirectory.Append(newCurrentDirectory); - delete newCurrentDirectory; + delete[] newCurrentDirectory; VERIFY(::SetCurrentDirectory(currentDirectory)); - delete currentDirectory; + delete[] currentDirectory; // Clean up filter buffers delete[] filterBuffer; diff --git a/mozilla/widget/src/windows/nsStringUtil.h b/mozilla/widget/src/windows/nsStringUtil.h index eb29d32afee..16319bb7bbc 100644 --- a/mozilla/widget/src/windows/nsStringUtil.h +++ b/mozilla/widget/src/windows/nsStringUtil.h @@ -73,7 +73,7 @@ #define NS_FREE_CHAR_BUF(aBuf) \ if (! _ns_smallBufUsed) \ - delete aBuf; + delete[] aBuf; -#endif // NSStringUtil \ No newline at end of file +#endif // NSStringUtil diff --git a/mozilla/widget/src/xpwidgets/nsHTToolbarDataModel.cpp b/mozilla/widget/src/xpwidgets/nsHTToolbarDataModel.cpp index 1861e6096e4..f0eb0fbf4d7 100644 --- a/mozilla/widget/src/xpwidgets/nsHTToolbarDataModel.cpp +++ b/mozilla/widget/src/xpwidgets/nsHTToolbarDataModel.cpp @@ -146,7 +146,7 @@ nsHTToolbarDataModel :: RequestImage(nsString& reqUrl) const (nsIImageRequestObserver*)this, NULL, 0, 0, 0); - delete url; + delete[] url; return request; } // RequestImage diff --git a/mozilla/widget/src/xpwidgets/nsHTTreeDataModel.cpp b/mozilla/widget/src/xpwidgets/nsHTTreeDataModel.cpp index 15feef7b280..1d00468f331 100644 --- a/mozilla/widget/src/xpwidgets/nsHTTreeDataModel.cpp +++ b/mozilla/widget/src/xpwidgets/nsHTTreeDataModel.cpp @@ -304,7 +304,7 @@ nsIImageRequest* nsHTTreeDataModel::RequestImage(nsString& reqUrl) const (nsIImageRequestObserver*)this, NULL, 0, 0, 0); - delete url; + delete[] url; return request; } diff --git a/mozilla/widget/src/xpwidgets/nsHTTreeItem.cpp b/mozilla/widget/src/xpwidgets/nsHTTreeItem.cpp index d73a8532f52..939fdb25843 100644 --- a/mozilla/widget/src/xpwidgets/nsHTTreeItem.cpp +++ b/mozilla/widget/src/xpwidgets/nsHTTreeItem.cpp @@ -183,7 +183,7 @@ nsIImageRequest* nsHTTreeItem::RequestImage(nsString& reqUrl) const (nsIImageRequestObserver*)this, NULL, 0, 0, 0); - delete url; + delete[] url; return request; } diff --git a/mozilla/widget/src/xpwidgets/nsTransferable.cpp b/mozilla/widget/src/xpwidgets/nsTransferable.cpp index c239ddcc379..d921ed00403 100644 --- a/mozilla/widget/src/xpwidgets/nsTransferable.cpp +++ b/mozilla/widget/src/xpwidgets/nsTransferable.cpp @@ -85,7 +85,7 @@ nsTransferable::~nsTransferable() delete mStrCache; } if (mDataPtr) { - delete mDataPtr; + delete[] mDataPtr; } } @@ -159,7 +159,7 @@ NS_IMETHODIMP nsTransferable::IsDataFlavorSupported(nsIDataFlavor * aDataFlavor) NS_IMETHODIMP nsTransferable::GetTransferData(nsIDataFlavor * aDataFlavor, void ** aData, PRUint32 * aDataLen) { if (mDataPtr) { - delete mDataPtr; + delete[] mDataPtr; } nsAutoString mimeInQuestion; diff --git a/mozilla/widget/tests/widget/nsWidgetTest.cpp b/mozilla/widget/tests/widget/nsWidgetTest.cpp index 8e3b7ac030b..07f46507013 100644 --- a/mozilla/widget/tests/widget/nsWidgetTest.cpp +++ b/mozilla/widget/tests/widget/nsWidgetTest.cpp @@ -223,7 +223,7 @@ void listSelfTest(FILE * fd, char * aTitle, nsIListWidget * listBox) { fprintf(fd, "\nTesting GetSelectedItem\n"); fprintf(fd, "\tSelection should be [%s] is [%s] Test: [%s]\n", item4, selStr, eval(!strcmp(item4, selStr))); fflush(fd); - if (nsnull != selStr) delete selStr; + if (nsnull != selStr) delete[] selStr; int sel = listBox->GetSelectedIndex(); fprintf(fd, "\nTesting GetSelectedIndex\n");fflush(fd); @@ -238,7 +238,7 @@ void listSelfTest(FILE * fd, char * aTitle, nsIListWidget * listBox) { listBox->GetItemAt(buf, 4); selStr = buf.ToNewCString(); fprintf(fd, "\nTesting GetItemAt\n\tItem %d should be [%s] is [%s] Test: [%s]\n", inx, item4, selStr, eval(strcmp(selStr, item4) == 0)); fflush(fd); - if (nsnull != selStr) delete selStr; + if (nsnull != selStr) delete[] selStr; listBox->SelectItem(2); inx = listBox->GetSelectedIndex(); @@ -252,7 +252,7 @@ void listSelfTest(FILE * fd, char * aTitle, nsIListWidget * listBox) { fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); - if (nsnull != str) delete str; + if (nsnull != str) delete[] str; } fprintf(fd, "Removing Item #4\n");fflush(fd); listBox->RemoveItemAt(4); @@ -267,7 +267,7 @@ void listSelfTest(FILE * fd, char * aTitle, nsIListWidget * listBox) { fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); - if (nsnull != str) delete str; + if (nsnull != str) delete[] str; } listBox->Deselect(); fprintf(fd, "\nTesting Deselect\n\t Selected Item [%d] Test:[%s]\n", (int)listBox->GetSelectedIndex(), (-1 == (int)listBox->GetSelectedIndex()?"PASSED":"FAILED")); fflush(fd); @@ -308,7 +308,7 @@ void textSelfTest(FILE * fd, char * aTitle, nsITextWidget * aTextWidget) { char * s2 = "1xxx234567890"; fprintf(fd, "Tested InsertText Test [%s] is [%s] [%s]\n", s2, s, eval(!strcmp(s2, s))); fprintf(fd, "Tested InsertText Test [%s]\n", s); - delete s; + delete[] s; } @@ -333,7 +333,7 @@ void multiListSelfTest(FILE * fd, char * aTitle, nsIListBox * listBox) { selStr = buf.ToNewCString(); fprintf(fd, "\nTesting GetItemAt\n\tItem %d should be [%s] is [%s] Test: [%s]\n", inx, item4, selStr, eval(strcmp(selStr, item4) == 0)); fflush(fd); - if (nsnull != selStr) delete selStr; + if (nsnull != selStr) delete[] selStr; multi->Deselect(); @@ -356,7 +356,7 @@ void multiListSelfTest(FILE * fd, char * aTitle, nsIListBox * listBox) { selStr = selItem.ToNewCString(); fprintf(fd, "\nTesting GetSelectedItem\n\t is [%s] should be [%s] Test: [%s]\n", selStr, item0, eval(!strcmp(selStr, item0))); fflush(fd); - if (nsnull != selStr) delete selStr;*/ + if (nsnull != selStr) delete[] selStr;*/ int status = 1; count = multi->GetSelectedCount(); @@ -387,7 +387,7 @@ void multiListSelfTest(FILE * fd, char * aTitle, nsIListBox * listBox) { fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); - if (nsnull != str) delete str; + if (nsnull != str) delete[] str; } fprintf(fd, "Removing Item #4\n");fflush(fd); multi->RemoveItemAt(4); @@ -402,7 +402,7 @@ void multiListSelfTest(FILE * fd, char * aTitle, nsIListBox * listBox) { fprintf(fd, "Item %d [%s]\n", i, str);fflush(fd); - if (nsnull != str) delete str; + if (nsnull != str) delete[] str; } fprintf(fd, "Done with Mulitple List Box\n"); } @@ -508,7 +508,7 @@ nsEventStatus PR_CALLBACK GenericListHandleEvent(nsGUIEvent *aEvent, char * aTit statusText->SetText(str,actualSize); gFailedMsg = "List::RemoveItemAt && FindItem"; } - delete title; + delete[] title; //NS_RELEASE(btn); } return nsEventStatus_eIgnore; @@ -598,7 +598,7 @@ nsEventStatus PR_CALLBACK MultiListBoxTestHandleEvent(nsGUIEvent *aEvent) statusText->SetText(str,actualSize); gFailedMsg = "Multi-List::FindItem && RemoveItemAt"; } - delete title; + delete[] title; //NS_RELEASE(btn); } return nsEventStatus_eIgnore; @@ -769,7 +769,7 @@ nsEventStatus PR_CALLBACK GenericTextTestHandleEvent(char *aTitle, statusText->SetText(str,actualSize); gFailedMsg = "nsITextWidget::SetSelection"; } - delete title; + delete[] title; //NS_RELEASE(btn); } return nsEventStatus_eIgnore; @@ -807,7 +807,7 @@ nsEventStatus PR_CALLBACK ButtonTestHandleEvent(nsGUIEvent *aEvent) gFailedMsg = "nsIWidget::Show(TRUE)"; } - delete title; + delete[] title; //NS_RELEASE(btn); } @@ -1031,8 +1031,10 @@ nsEventStatus PR_CALLBACK HandleFileButtonEvent(nsGUIEvent *aEvent) if (result) { nsString file; fileWidget->GetFile(file); - printf("file widget contents %s\n", file.ToNewCString()); - statusText->SetText(file.ToNewCString(),actualSize); + char* filestr = file.ToNewCString(); + printf("file widget contents %s\n", filestr); + statusText->SetText(filestr,actualSize); + delete[] filestr; } else statusText->SetText("Cancel selected",actualSize); diff --git a/mozilla/xpcom/tests/PropertiesTest.cpp b/mozilla/xpcom/tests/PropertiesTest.cpp index 484df199998..e95c56e05fa 100644 --- a/mozilla/xpcom/tests/PropertiesTest.cpp +++ b/mozilla/xpcom/tests/PropertiesTest.cpp @@ -120,6 +120,7 @@ main(int argc, char *argv[]) } char *value = v.ToNewCString(); cout << "\"" << i << "\"=\"" << value << "\"" << endl; + delete[] value; i++; } diff --git a/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp b/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp index 426b6d0e1a8..11ab0e06b85 100644 --- a/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp +++ b/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp @@ -467,6 +467,8 @@ nsBrowserAppCore::LoadUrl(const nsString& aUrl) /* Ask nsWebShell to load the URl */ mContentAreaWebShell->LoadURL(nsString(urlstr), nsnull, nsnull); + delete[] urlstr; + return NS_OK; } @@ -538,7 +540,11 @@ nsBrowserAppCore::SetWebShellWindow(nsIDOMWindow* aWin) webShell->GetName( &name); nsAutoString str(name); - if (APP_DEBUG) printf("Attaching to WebShellWindow[%s]\n", str.ToNewCString()); + if (APP_DEBUG) { + char* cstr = str.ToNewCString(); + printf("Attaching to WebShellWindow[%s]\n", cstr); + delete[] cstr; + } nsIWebShellContainer * webShellContainer; webShell->GetContainer(webShellContainer); @@ -810,7 +816,11 @@ nsBrowserAppCore::ExecuteScript(nsIScriptContext * aContext, const nsString& aSc const char* url = ""; PRBool isUndefined = PR_FALSE; nsString rVal; - if (APP_DEBUG) printf("Executing [%s]\n", aScript.ToNewCString()); + if (APP_DEBUG) { + char* script_str = aScript.ToNewCString(); + printf("Executing [%s]\n", script_str); + delete[] script_str; + } aContext->EvaluateString(aScript, url, 0, rVal, &isUndefined); } return NS_OK; diff --git a/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp b/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp index a07acdf9d8d..af234d4a27e 100755 --- a/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp +++ b/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp @@ -124,7 +124,9 @@ static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID); nsEditorAppCore::nsEditorAppCore() { - if (APP_DEBUG) printf("Created nsEditorAppCore\n"); +#ifdef APP_DEBUG + printf("Created nsEditorAppCore\n"); +#endif mScriptObject = nsnull; mToolbarWindow = nsnull; @@ -405,7 +407,11 @@ nsEditorAppCore::SetWebShellWindow(nsIDOMWindow* aWin) webShell->GetName( &name); nsAutoString str(name); - if (APP_DEBUG) printf("Attaching to WebShellWindow[%s]\n", str.ToNewCString()); +#ifdef APP_DEBUG + char* cstr = str.ToNewCString(); + printf("Attaching to WebShellWindow[%s]\n", str.ToNewCString()); + delete[] cstr; +#endif nsIWebShellContainer * webShellContainer; webShell->GetContainer(webShellContainer); @@ -542,7 +548,9 @@ done: void GenerateBarItem(FILE * fd, char * aFileName, const nsString & aDesc, void * aData, PRUint32 aLen) { fprintf(fd, "\n", aFileName); char name[256]; @@ -842,7 +850,13 @@ nsEditorAppCore::ExecuteScript(nsIScriptContext * aContext, const nsString& aScr const char* url = ""; PRBool isUndefined = PR_FALSE; nsString rVal; - if (APP_DEBUG) printf("Executing [%s]\n", aScript.ToNewCString()); + +#ifdef APP_DEBUG + char* script_str = aScript.ToNewCString(); + printf("Executing [%s]\n", aScript.ToNewCString()); + delete[] script_str; +#endif + aContext->EvaluateString(aScript, url, 0, rVal, &isUndefined); } return NS_OK;