Re: [xml] FW: Some more memleak fixes in Parser.c
- From: Daniel Veillard <veillard redhat com>
- To: Ashwin <ashwins huawei com>
- Cc: xml gnome org, ranjit huawei com
- Subject: Re: [xml] FW: Some more memleak fixes in Parser.c
- Date: Wed, 27 Aug 2008 14:50:06 +0200
On Thu, Apr 24, 2008 at 05:12:48PM +0800, Ashwin wrote:
While the description sounds good, the patch didn't apply to CVS, could
you double-check the patch please ?
Hi,
Sorry for the delay in reply. I didn't understand, you mean the patch was
wrong? Anyway I am attaching patch again, please let me know if it is ok...
Basically checking if a mem error has occurred in inputPush and returning
from there if it has....
Another query is for a lot of places where Inputpush function is invoked
the
return value is not checked, from what I could make out this is because at
the time of context creation the number of input streams is set to 5, and
since push is being called directly afterwards, the number of streams will
not be more than 5 and thus the realloc block inside inputPush will not be
hit. So perhaps that is why memory failure is not expected in those paths.
Hum, no, I guess it's an oversight which should be fixed too.
Inside inputPush function if realloc fails I am now freeing the
inputstream, however I am not 100% sure this is the correct way to go about
it...
Another old patch pending, yes this need to be fixed, I just changed
a couple of things:
- made xmlPushinput return an int, that's a compatible change
- made pushInput return -1 on error instead of -1 like all other push
functions, none of libxml2 code was testing the return value anyway
because this was broken, 0 is a legal value which you should get
when pushing the first entity.
Some further cleanup would be to check inputPush() return value
everywhere, and that's around 30 places within libxml2. Most of them
though are used for the main entity, so I guess if it fails the failure
is caught pretty soon as there is nothing to parse !
thanks for the patch, sorry for the delay,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]