[xml] Problem in case of Failure of xmlGetGlobalState



Hi,        
This is with reference to the xmlGetGlobalState function. If this function returns NULL due to a failure in xmlNewGlobalState function, then it will lead to a crash in functions like     __xmlBufferAllocScheme on the line
       return (&xmlGetGlobalState()->xmlBufferAllocScheme);

  There are a number of functions like this in globals.c and all of them will have the same problem.
    At first i thought having a check for the return value of xmlGetGlobalState function would take care of the problem, but it will not, because if we return NULL from there the macros defined in globals.h would try to de-reference NULL pointers.

 So I am thinking we need to return a function pointer to a dummy function(in case xmlGetGlobalState fails) which will always return NULL in order to solve the problem. Is this the correct way to go about it, or is there a better way?

Thanks
Ashwin

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