Re: [xml] FW: Some more memleak fixes in Parser.c

On Wed, Apr 02, 2008 at 11:38:48AM +0530, Ashwin wrote:
Oops, forgot to attach the patch!!! Sorry


   I am attaching a patch for memleak in InputPush function in case
fails. realloc was being done on the original pointer, and inputstream
was not being freed in case of failure. Also returning from functions >>
calling xmlPushInput if memory failure has occurred (Not sure whther this
is required in all cases).

While the description sounds good, the patch didn't apply to CVS, could 
you double-check the patch please ?
   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
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


Attachment: parserpatch.txt
Description: Text document

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]