nsDOMDataTransfer::ConvertFromVariant leaks, r=enndeakin

This commit is contained in:
Olli Pettay 2010-01-21 19:47:19 +02:00
parent 0a84ea23e4
commit 866fa05bf4

View File

@ -673,16 +673,19 @@ nsDOMDataTransfer::ConvertFromVariant(nsIVariant* aVariant,
}
PRUnichar* chrs;
nsresult rv = aVariant->GetAsWString(&chrs);
PRUint32 len = 0;
nsresult rv = aVariant->GetAsWStringWithSize(&len, &chrs);
if (NS_FAILED(rv))
return PR_FALSE;
nsAutoString str;
str.Adopt(chrs, len);
nsCOMPtr<nsISupportsString>
strSupports(do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
if (!strSupports)
return PR_FALSE;
nsAutoString str(chrs);
strSupports->SetData(str);
*aSupports = strSupports;