mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 413424 - PNG encoder leaks a string. r=stuart, a1.9=schrep, guilty=dolske
This commit is contained in:
parent
40fe97dc61
commit
aaac9bf4aa
@ -336,10 +336,12 @@ nsPNGEncoder::ParseOptions(const nsAString& aOptions,
|
|||||||
PRUint32* offsetX,
|
PRUint32* offsetX,
|
||||||
PRUint32* offsetY)
|
PRUint32* offsetY)
|
||||||
{
|
{
|
||||||
char* token;
|
// Make a copy of aOptions, because strtok() will modify it.
|
||||||
char* options = nsCRT::strdup(PromiseFlatCString(NS_ConvertUTF16toUTF8(aOptions)).get());
|
nsCAutoString optionsCopy;
|
||||||
|
optionsCopy.Assign(NS_ConvertUTF16toUTF8(aOptions));
|
||||||
|
char* options = optionsCopy.BeginWriting();
|
||||||
|
|
||||||
while ((token = nsCRT::strtok(options, ";", &options))) {
|
while (char* token = nsCRT::strtok(options, ";", &options)) {
|
||||||
// If there's an '=' character, split the token around it.
|
// If there's an '=' character, split the token around it.
|
||||||
char* equals = token, *value = nsnull;
|
char* equals = token, *value = nsnull;
|
||||||
while(*equals != '=' && *equals) { ++equals; }
|
while(*equals != '=' && *equals) { ++equals; }
|
||||||
|
Loading…
Reference in New Issue
Block a user