
On Tue, Feb 19, 2008 at 10:09:20AM +0100, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Mon, Feb 18, 2008 at 09:51:28AM -0500, Daniel Veillard wrote:
On Tue, Feb 12, 2008 at 04:36:04AM +0000, Daniel P. Berrange wrote: ...
+ if (xml) + xmlFreeDoc(xml); + return NULL; +}
since we try to remove if (x) free(x) style, just call xmlFreeDoc(xml); since xmlFreeDoc handles NULLs fine.
Yes, I did 'make syntax-check' but seems to have missed those
To make it check for that, add a line in Makefile.cfg:
useless_free_options = \ --name=sexpr_free \ --name=xmlXPathFreeContext \ --name=xmlXPathFreeObject
FYI, I did consider adding it a week or two ago, but saw the xmlGenericError call in libxml2/tree.c:
void xmlFreeDoc(xmlDocPtr cur) { xmlDtdPtr extSubset, intSubset; xmlDictPtr dict = NULL;
if (cur == NULL) { #ifdef DEBUG_TREE xmlGenericError(xmlGenericErrorContext, "xmlFreeDoc : document == NULL\n"); #endif return; }
Of course, if DV says it's ok, I guess that #ifdef'd code is not an issue.
Well DEBUG_TREE is not defined by default in libxml2 builds, really all xml*Free* should be okay with NULL pointers, that's part of regression tests, well except for xmlFree which is an indirection to the OS free() established at link time. 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/