[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv2 12/13] list: new helper function to collect snapshots



On 06/14/2012 10:18 PM, Eric Blake wrote:
> Wraps the conversion from 'char *name' to virDomainSnapshotPtr in
> a reusable manner.
> 
> * src/conf/virdomainlist.h (virDomainListSnapshots): New declaration.
> * src/conf/virdomainlist.c (virDomainListSnapshots): Implement it.
> * src/libvirt_private.syms (virdomainlist.h): Export it.
> ---
> 
> v2: no real change
> 

Turns out I needed to squash this in after all, to avoid calling
virGetDomainSnapshot with a NULL argument.

> +
> +    virDomainSnapshotObjListGetNames(snapshots, from, names, count, flags);
> +    for (i = 0; i < count; i++)
> +        if ((list[i] = virGetDomainSnapshot(dom, names[i])) == NULL)
> +            goto cleanup;

diff --git i/src/conf/virdomainlist.c w/src/conf/virdomainlist.c
index 663591a..6ac2af1 100644
--- i/src/conf/virdomainlist.c
+++ w/src/conf/virdomainlist.c
@@ -202,7 +202,9 @@ virDomainListSnapshots(virDomainSnapshotObjListPtr
snapshots,
         goto cleanup;
     }

-    virDomainSnapshotObjListGetNames(snapshots, from, names, count, flags);
+    if (virDomainSnapshotObjListGetNames(snapshots, from, names, count,
+                                         flags) < 0)
+        goto cleanup;
     for (i = 0; i < count; i++)
         if ((list[i] = virGetDomainSnapshot(dom, names[i])) == NULL)
             goto cleanup;

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]