зеркало из https://github.com/mozilla/pjs.git
116972 r=dmose sr=sspitzer. fix leaks upon autocompletion in compose window and when sending mail. may
fix other leaks in address book because now we made it sure that it frees up when we do a copy in CharPtrGuardArray... and don't do a copy when not needed.
This commit is contained in:
Родитель
241b8c024c
Коммит
0b71edda50
|
@ -66,10 +66,9 @@ nsresult CStringArrayToCharPtrArray::Convert (nsCStringArray& array,
|
|||
{
|
||||
|
||||
if (copyElements == PR_TRUE)
|
||||
(*returnPropertiesArray)[i] =
|
||||
ToNewCString(*array[i]);
|
||||
else
|
||||
(*returnPropertiesArray)[i] = ToNewCString(*array[i]);
|
||||
else
|
||||
(*returnPropertiesArray)[i] = NS_CONST_CAST(char*, (*array[i]).get());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -120,10 +119,9 @@ nsresult StringArrayToPRUnicharPtrArray::Convert (nsStringArray& array,
|
|||
{
|
||||
|
||||
if (copyElements == PR_TRUE)
|
||||
(*returnPropertiesArray)[i] =
|
||||
ToNewUnicode(*array[i]);
|
||||
(*returnPropertiesArray)[i] = ToNewUnicode(*array[i]);
|
||||
else
|
||||
(*returnPropertiesArray)[i] = ToNewUnicode(*array[i]);
|
||||
(*returnPropertiesArray)[i] = NS_CONST_CAST(PRUnichar*, (*array[i]).get());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -104,6 +104,11 @@ private:
|
|||
|
||||
if (mFreeElements == PR_TRUE)
|
||||
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mSize, mArray);
|
||||
else
|
||||
{
|
||||
nsMemory::Free(mArray);
|
||||
mArray=nsnull;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -192,7 +197,12 @@ private:
|
|||
return;
|
||||
|
||||
if (mFreeElements == PR_TRUE)
|
||||
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mSize, mArray);
|
||||
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mSize, mArray);
|
||||
else
|
||||
{
|
||||
nsMemory::Free(mArray);
|
||||
mArray=nsnull;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче