[xpcom] Even more memory leak fixes...
authorKalle Vahlman <kalle.vahlman@movial.com>
Thu, 30 Apr 2009 10:16:19 +0000 (13:16 +0300)
committerKalle Vahlman <kalle.vahlman@movial.com>
Thu, 30 Apr 2009 10:24:39 +0000 (13:24 +0300)
xpcom-dbusservice/DBusMarshaling.cpp

index 48227efd001097a5af1e1c75ad2482410304a5fc..d583330135307406909ba21df4535faed7d29bfa 100644 (file)
@@ -277,11 +277,14 @@ getSignatureFromVariant(JSContext* cx, nsIVariant *aVariant, nsCString &aResult)
                 // get element signature from first element
                 nsISupports *element = ((nsISupports **)data_ptr)[0];
                 getSignatureFromISupports(cx, element, elementsig);
+                for (PRUint32 i = 0; i < count; i++)
+                    NS_IF_RELEASE(((nsISupports **)data_ptr)[i]);
+
             }
-            else if (type == nsIDataType::VTYPE_ARRAY)
+            else if (type == nsIDataType::VTYPE_WCHAR_STR)
             {
-                // FIXME - can this happen?
-                BDBLOG(("    element type array, don't know how to handle\n"));
+                for (PRUint32 i = 0; i < count; i++)
+                    nsMemory::Free(((char**)data_ptr)[i]);
             }
             else
             {
@@ -1031,6 +1034,7 @@ addJSValueToIter(JSContext *cx, jsval *aValue, DBusMessageIter *aIter, DBusSigna
                 NS_ENSURE_SUCCESS(rs, );
 
                 addVariantToIter(cx, var, aIter, aSigIter);
+                NS_IF_RELEASE(var);
             }
             
             break;