[Libvirt-cim] [PATCH V3 08/11] device parsing, add debug print

John Ferlan jferlan at redhat.com
Mon Mar 11 15:24:58 UTC 2013


Since I didn't have the original email to reply-to, here is the link:

https://www.redhat.com/archives/libvirt-cim/2012-December/msg00029.html

Should the following return 0 as well?:

+        if (ret != 1) {
+                CU_DEBUG("Failed to translate xml into struct domain");
+        }

Especially since get_dominfo_from_xml() will free and initialize dominfo to NULL.

You'll also need a "free(xml);" if you return.  That's a memory leak.

What probably should be done is (btw: 8 space tabs are hard to do!)


        ret = get_dominfo_from_xml(xml, dominfo);
        if (ret == 0) {
                CU_DEBUG("Failed to translate xml into struct domain");
                goto out;
        }
        ret = virDomainGetAutostart(dom,  &start);
        if (ret !=  0) {
                CU_DEBUG("Failed to get dom autostart with libvirt API.");
                goto out;
        }
        (*dominfo)->autostrt = start;

 out:
        free(xml);

        return ret;





John




More information about the Libvirt-cim mailing list