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

Wenchao Xia xiawenc at linux.vnet.ibm.com
Tue Mar 12 05:14:16 UTC 2013


于 2013-3-11 23:24, John Ferlan 写道:
>
> 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
>
   Yes, this seems fine.

> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>


-- 
Best Regards

Wenchao Xia




More information about the Libvirt-cim mailing list