Bug 1141066 - Fix a memory leak if vCardHasData allocation failed. r=Neil
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 09 Mar 2015 14:43:18 +0100
changeset 22156 f3126fc6d739b9dff7a0c8213fb83172a3e1e216
parent 22155 94a6184a5646ac8fb513afbfa08d792f3eb144a1
child 22157 8b2f80525b326cb6c88271711e2a605c329bbdb7
push id1385
push usermbanner@mozilla.com
push dateMon, 11 May 2015 19:50:21 +0000
treeherdercomm-beta@2b24a4d6cd0e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs1141066
Bug 1141066 - Fix a memory leak if vCardHasData allocation failed. r=Neil
mailnews/addrbook/src/nsAbCardProperty.cpp
--- a/mailnews/addrbook/src/nsAbCardProperty.cpp
+++ b/mailnews/addrbook/src/nsAbCardProperty.cpp
@@ -696,16 +696,17 @@ nsresult nsAbCardProperty::ConvertToEsca
     {
         myAddPropValue(vObj, VCURLProp, str.get(), &vCardHasData);
     }
 
     myAddPropValue(vObj, VCVersionProp, MOZ_UTF16("2.1"), nullptr);
 
     if (!vCardHasData) {
         aResult.Truncate();
+        cleanVObject(vObj);
         return NS_OK;
     }
 
     int len = 0;
     char *vCard = writeMemVObject(0, &len, vObj);
     if (vObj)
         cleanVObject(vObj);