From 593346e22de9e3a8e2a46b182f8dbd0e362e3516 Mon Sep 17 00:00:00 2001 From: "gagan%netscape.com" Date: Fri, 27 Aug 1999 10:03:07 +0000 Subject: [PATCH] More mem leak fixes. git-svn-id: svn://10.0.0.236/trunk@44797 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/test/urltest.cpp | 19 +++++++++---------- .../webshell/tests/viewer/nsWebCrawler.cpp | 9 ++++----- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/mozilla/netwerk/test/urltest.cpp b/mozilla/netwerk/test/urltest.cpp index 17cf8e86d41..8c565970458 100644 --- a/mozilla/netwerk/test/urltest.cpp +++ b/mozilla/netwerk/test/urltest.cpp @@ -70,19 +70,18 @@ int writeout(const char* i_pURL, PRBool bUseStd =PR_TRUE) } if (NS_SUCCEEDED(result)) { - char* temp; + nsXPIDLCString temp; PRInt32 port; - pURL->GetScheme(&temp); - cout << "Got " << (temp ? temp : "") << ','; - pURL->GetPreHost(&temp); - cout << (temp ? temp : "") << ','; - pURL->GetHost(&temp); - cout << (temp ? temp : "") << ','; + pURL->GetScheme(getter_Copies(temp)); + cout << "Got " << (temp ? (const char*)temp : "") << ','; + pURL->GetPreHost(getter_Copies(temp)); + cout << (temp ? (const char*)temp : "") << ','; + pURL->GetHost(getter_Copies(temp)); + cout << (temp ? (const char*)temp : "") << ','; pURL->GetPort(&port); cout << port << ','; - pURL->GetPath(&temp); - cout << (temp ? temp : "") << endl; - nsCRT::free(temp); + pURL->GetPath(getter_Copies(temp)); + cout << (temp ? (const char*)temp : "") << endl; } else { cout << "Can not create URL" << endl; } diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp index 96cda27a964..bcdc8adfc3c 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp @@ -41,6 +41,7 @@ #include "nsRect.h" #include "plhash.h" #include "nsINameSpaceManager.h" +#include "nsXPIDLString.h" static NS_DEFINE_IID(kIDocumentLoaderObserverIID, NS_IDOCUMENT_LOADER_OBSERVER_IID); static NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID); @@ -593,11 +594,12 @@ nsWebCrawler::OkToLoad(const nsString& aURLSpec) if (NS_OK == rv) { #ifdef NECKO - char* host; + nsXPIDLCString host; + rv = url->GetHost(getter_Copies(host)); #else const char* host; -#endif rv = url->GetHost(&host); +#endif if (rv == NS_OK) { PRInt32 hostlen = PL_strlen(host); @@ -627,9 +629,6 @@ nsWebCrawler::OkToLoad(const nsString& aURLSpec) } } ok = PR_FALSE; -#ifdef NECKO - nsCRT::free(host); -#endif } NS_RELEASE(url); }