Bug 569454 bad ownership model for allProperties in GRE_GetGREPathWithProperties, r+a=bsmedberg
authortimeless@mozdev.org
Thu, 09 Dec 2010 01:22:00 -0800
changeset 59656 125be03bd296799f0301ccde8eb2cdd3ff7a0597
parent 59655 84745bfb592efdacdecfcb463efc3cd988268df1
child 59657 6b09edde1450a1aae390679732faa199fc3092f0
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
bugs569454
milestone2.0b9pre
Bug 569454 bad ownership model for allProperties in GRE_GetGREPathWithProperties, r+a=bsmedberg
xpcom/glue/nsGREGlue.cpp
--- a/xpcom/glue/nsGREGlue.cpp
+++ b/xpcom/glue/nsGREGlue.cpp
@@ -163,17 +163,17 @@ GRE_GetGREPathWithProperties(const GREVe
                              char *aBuffer, PRUint32 aBufLen)
 {
 #ifdef TARGET_XPCOM_ABI
   // append the ABI to the properties to match only binary 
   // compatible GREs
   static const GREProperty kExtraProperty =
     { "abi", TARGET_XPCOM_ABI };
 
-  GREProperty *allProperties = new GREProperty[propertiesLength + 1];
+  nsAutoArrayPtr<GREProperty> allProperties(new GREProperty[propertiesLength + 1]);
   if (!allProperties)
     return NS_ERROR_OUT_OF_MEMORY;
 
   for (PRUint32 i=0; i<propertiesLength; i++) {
     allProperties[i].property = properties[i].property;
     allProperties[i].value    = properties[i].value;
   }
   allProperties[propertiesLength].property = kExtraProperty.property;