Bug 656991 - Followup. Use JS_free instead of free. r=bz
authorJustin Lebar <justin.lebar@gmail.com>
Mon, 16 May 2011 16:36:12 -0400
changeset 69828 794c73cbfca6b62cfdbb20e82eb91cc15b30ad8b
parent 69827 7f910859214bd8690745e8348e1cf2d37ecefefc
child 69829 db4ba8614fb65e3951f99e3f10ee90734d72def3
push idunknown
push userunknown
push dateunknown
reviewersbz
bugs656991
milestone6.0a1
Bug 656991 - Followup. Use JS_free instead of free. r=bz
dom/base/nsStructuredCloneContainer.cpp
--- a/dom/base/nsStructuredCloneContainer.cpp
+++ b/dom/base/nsStructuredCloneContainer.cpp
@@ -92,25 +92,30 @@ nsStructuredCloneContainer::InitFromVari
   NS_ENSURE_STATE(success);
   NS_ENSURE_STATE(jsBytes);
 
   // Copy jsBytes into our own buffer.
   mData = (PRUint64*) malloc(mSize);
   if (!mData) {
     mSize = 0;
     mVersion = 0;
-    free(jsBytes);
+
+    // FIXME This should really be js::Foreground::Free, but that's not public.
+    JS_free(aCx, jsBytes);
+
     return NS_ERROR_FAILURE;
   }
   else {
     mVersion = JS_STRUCTURED_CLONE_VERSION;
   }
 
   memcpy(mData, jsBytes, mSize);
-  free(jsBytes);
+
+  // FIXME Similarly, this should be js::Foreground::free.
+  JS_free(aCx, jsBytes);
   return NS_OK;
 }
 
 nsresult
 nsStructuredCloneContainer::InitFromBase64(const nsAString &aData,
                                            PRUint32 aFormatVersion,
                                            JSContext *aCx)
 {