patch: kjs lexer leak
porten at froglogic.com
porten at froglogic.com
Thu Nov 6 22:06:25 CET 2003
On Mon, 3 Nov 2003, Maciej Stachowiak wrote:
>
> This fixes the KJS lexer leak when you get a parse error:
Great that someone started to tackle this very old problem!
I've attached a patch that fixes some things.
Hmmm. Either I did something wrong when applying the patch or
there's still a problem left: parse errors cause dangling nodes that will
never be deleted. Test case: "foo" "bar";
Thanks,
Harri.
-------------- next part --------------
--- lexer.cpp.org Thu Nov 6 21:49:06 2003
+++ lexer.cpp Thu Nov 6 21:49:39 2003
@@ -845,7 +845,7 @@
for (unsigned i = 0; i < numIdentifiers; i++) {
delete identifiers[i];
}
- delete identifiers;
+ free(identifiers);
identifiers = 0;
numIdentifiers = 0;
identifiersCapacity = 0;
@@ -853,7 +853,7 @@
for (unsigned i = 0; i < numStrings; i++) {
delete strings[i];
}
- delete strings;
+ free(strings);
strings = 0;
numStrings = 0;
stringsCapacity = 0;
@@ -869,7 +869,7 @@
identifiers = (KJS::Identifier **)realloc(identifiers, sizeof(KJS::Identifier *) * identifiersCapacity);
}
- KJS::Identifier *identifier = new KJS::Identifier(buffer16, pos16);
+ KJS::Identifier *identifier = new KJS::Identifier(buffer, pos);
identifiers[numIdentifiers++] = identifier;
return identifier;
}
@@ -881,7 +881,7 @@
strings = (UString **)realloc(strings, sizeof(UString *) * stringsCapacity);
}
- UString *string = new UString(buffer16, pos16);
+ UString *string = new UString(buffer, pos);
strings[numStrings++] = string;
return string;
}
More information about the Khtml-devel
mailing list