[Libvirt-cim] [PATCH 2 of 4] Add logic to generate a pool XML to xmlgen.c

Daniel Veillard veillard at redhat.com
Wed Mar 25 09:08:27 UTC 2009


On Mon, Mar 23, 2009 at 07:40:32AM -0700, Kaitlin Rupert wrote:
[...]
> +        net = xmlNewChild(root, NULL, BAD_CAST "network", NULL);
> +        if (net == NULL)
> +                goto out;
[...]
> +
> + out:
> +        return msg;
> +}

  I'm a bit surprized, all of there error ends up being ignored
or at least not reported, I would expect a goto an error label and
then some kind of logging at least

> +char *pool_to_xml(struct virt_pool *pool) {
[...]
> +        root = xmlNewNode(NULL, BAD_CAST "tmp");
> +        if (root == NULL)
> +                goto out;

  same here

[...]
> + out:
> +        CU_DEBUG("Created Device XML:\n%s\n", xml);

  hum %s with NULL can be nasty, I really think a specific error
  handling is needed here :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the Libvirt-cim mailing list