plug leak in CheckForTrailingSlash. r:nisheeth

This commit is contained in:
danm%netscape.com 1999-03-22 21:53:58 +00:00
Родитель 9722af1758
Коммит 493f3c64d9
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -2269,13 +2269,14 @@ nsresult nsWebShell::CheckForTrailingSlash(nsIURL* aURL)
aURL->GetSpec(&spec); aURL->GetSpec(&spec);
nsString* newURL = (nsString*) new nsString(spec); nsString* newURL = (nsString*) new nsString(spec);
if (newURL->Last() == '/' && !historyURL->Equals(*newURL)) { if (newURL && newURL->Last() == '/' && !historyURL->Equals(*newURL)) {
// Replace the top most history entry with the new url // Replace the top most history entry with the new url
if (nsnull != historyURL) { if (nsnull != historyURL) {
delete historyURL; delete historyURL;
} }
mHistory.ReplaceElementAt(newURL, mHistoryIndex); mHistory.ReplaceElementAt(newURL, mHistoryIndex);
} } else
delete newURL;
return NS_OK; return NS_OK;
} }

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

@ -2269,13 +2269,14 @@ nsresult nsWebShell::CheckForTrailingSlash(nsIURL* aURL)
aURL->GetSpec(&spec); aURL->GetSpec(&spec);
nsString* newURL = (nsString*) new nsString(spec); nsString* newURL = (nsString*) new nsString(spec);
if (newURL->Last() == '/' && !historyURL->Equals(*newURL)) { if (newURL && newURL->Last() == '/' && !historyURL->Equals(*newURL)) {
// Replace the top most history entry with the new url // Replace the top most history entry with the new url
if (nsnull != historyURL) { if (nsnull != historyURL) {
delete historyURL; delete historyURL;
} }
mHistory.ReplaceElementAt(newURL, mHistoryIndex); mHistory.ReplaceElementAt(newURL, mHistoryIndex);
} } else
delete newURL;
return NS_OK; return NS_OK;
} }