[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] Problem in case of Failure of xmlGetGlobalState
- From: Daniel Veillard <veillard redhat com>
- To: ashwin sinha <4shw1ns1nh4 gmail com>
- Cc: xml gnome org, NageshS 70576 <nageshs huawei com>
- Subject: Re: [xml] Problem in case of Failure of xmlGetGlobalState
- Date: Tue, 8 Apr 2008 10:51:32 -0400
On Mon, Apr 07, 2008 at 08:42:48PM +0530, ashwin sinha wrote:
> 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?
maybe give a pointer to a dummy static data structure instead.
But any error in the thread code will be had to handle correctly,
The best is to avoid global varaibles altogether...
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]