Bug 505108: Don't leak strings on early returns from Area::ParseCoords(), fix how CString is freed. r=roc

This commit is contained in:
Randell Jesup 2011-06-11 16:40:39 -04:00
parent 2bb34bb2ca
commit f6fe96272c

View File

@ -151,6 +151,7 @@ void Area::ParseCoords(const nsAString& aSpec)
mCoords = nsnull;
if (*cp == '\0')
{
nsMemory::Free(cp);
return;
}
@ -164,6 +165,7 @@ void Area::ParseCoords(const nsAString& aSpec)
}
if (*n_str == '\0')
{
nsMemory::Free(cp);
return;
}
@ -248,6 +250,7 @@ void Area::ParseCoords(const nsAString& aSpec)
value_list = new nscoord[cnt];
if (!value_list)
{
nsMemory::Free(cp);
return;
}
@ -290,7 +293,7 @@ void Area::ParseCoords(const nsAString& aSpec)
mNumCoords = cnt;
mCoords = value_list;
NS_Free(cp);
nsMemory::Free(cp);
}
}