"Daniel P. Berrange" <berrange(a)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.