fix 45430. patch proposed by beard@netscape.com r=ftang a=ftang

fix memory leak
This commit is contained in:
ftang%netscape.com 2000-08-02 05:08:15 +00:00
Родитель 2a22c82fe2
Коммит 68a4a3dd66
2 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -724,6 +724,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
// like this because I think it's really bogus that layout is depending on bookmarks. This is very evil.
nsXPIDLCString scheme;
aURL->GetScheme(getter_Copies(scheme));
if (scheme && nsCRT::strcasecmp("about", scheme) && (kCharsetFromBookmarks > charsetSource))
{
nsCOMPtr<nsIRDFDataSource> datasource;
@ -732,14 +733,14 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
nsCOMPtr<nsIBookmarksService> bookmarks = do_QueryInterface(datasource);
if (bookmarks)
{
char* urlSpec = nsnull;
aURL->GetSpec(&urlSpec);
nsXPIDLCString urlSpec;
aURL->GetSpec(getter_Copies(urlSpec));
if (urlSpec)
{
PRUnichar *pBookmarkedCharset;
nsXPIDLString pBookmarkedCharset;
if (NS_SUCCEEDED(rv = bookmarks->GetLastCharset(urlSpec, &pBookmarkedCharset)) &&
if (NS_SUCCEEDED(rv = bookmarks->GetLastCharset(urlSpec, getter_Copies(pBookmarkedCharset))) &&
(rv != NS_RDF_NO_VALUE))
{
charset = pBookmarkedCharset;
@ -747,8 +748,6 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
}
}
nsCRT::free(urlSpec);
}
}
}

Просмотреть файл

@ -724,6 +724,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
// like this because I think it's really bogus that layout is depending on bookmarks. This is very evil.
nsXPIDLCString scheme;
aURL->GetScheme(getter_Copies(scheme));
if (scheme && nsCRT::strcasecmp("about", scheme) && (kCharsetFromBookmarks > charsetSource))
{
nsCOMPtr<nsIRDFDataSource> datasource;
@ -732,14 +733,14 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
nsCOMPtr<nsIBookmarksService> bookmarks = do_QueryInterface(datasource);
if (bookmarks)
{
char* urlSpec = nsnull;
aURL->GetSpec(&urlSpec);
nsXPIDLCString urlSpec;
aURL->GetSpec(getter_Copies(urlSpec));
if (urlSpec)
{
PRUnichar *pBookmarkedCharset;
nsXPIDLString pBookmarkedCharset;
if (NS_SUCCEEDED(rv = bookmarks->GetLastCharset(urlSpec, &pBookmarkedCharset)) &&
if (NS_SUCCEEDED(rv = bookmarks->GetLastCharset(urlSpec, getter_Copies(pBookmarkedCharset))) &&
(rv != NS_RDF_NO_VALUE))
{
charset = pBookmarkedCharset;
@ -747,8 +748,6 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
}
}
nsCRT::free(urlSpec);
}
}
}