nsDOMDataTransfer::ConvertFromVariant leaks, r=enndeakin
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 21 Jan 2010 19:47:19 +0200
changeset 37376 ec73b66a098a51ae2b0de6cf2bde205b58ea63f7
parent 37375 df945d87762db2b86135d5be9a6b197d4f240f51
child 37377 c551e8a012d746cccf8ffe2467e20c78a34049f9
child 46556 0729d32598380b28827836a269c211425c0ae850
push id11266
push useropettay@mozilla.com
push dateThu, 21 Jan 2010 17:58:30 +0000
treeherderautoland@ec73b66a098a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
milestone1.9.3a1pre
nsDOMDataTransfer::ConvertFromVariant leaks, r=enndeakin
content/events/src/nsDOMDataTransfer.cpp
--- a/content/events/src/nsDOMDataTransfer.cpp
+++ b/content/events/src/nsDOMDataTransfer.cpp
@@ -668,26 +668,29 @@ nsDOMDataTransfer::ConvertFromVariant(ns
 
       *aLength = sizeof(nsISupportsInterfacePointer *);
     }
 
     return PR_TRUE;
   }
 
   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;
   NS_ADDREF(*aSupports);
 
   // each character is two bytes
   *aLength = str.Length() << 1;