Bug 89184. Use nsXPIDLCString instead of uninitialized bare |char*|. r=dbaron, sr=jst.

This commit is contained in:
waterson%netscape.com 2001-07-18 19:34:14 +00:00
parent c8f15c867c
commit e79aa1d781

View File

@ -616,16 +616,15 @@ nsHTMLAnchorElement::GetHash(nsAWritableString& aHash)
result = NS_NewURI(getter_AddRefs(uri), href);
if (NS_OK == result) {
char *ref;
nsXPIDLCString ref;
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
if (url) {
result = url->GetRef(&ref);
result = url->GetRef(getter_Copies(ref));
}
if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {
aHash.Assign(PRUnichar('#'));
aHash.Append(NS_ConvertASCIItoUCS2(ref));
nsCRT::free(ref);
}
else {
aHash.SetLength(0);