]> xenbits.xensource.com Git - libvirt.git/commitdiff
xen_xm: Resolve Coverity USE_AFTER_FREE
authorJohn Ferlan <jferlan@redhat.com>
Wed, 27 Aug 2014 11:48:37 +0000 (07:48 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 27 Aug 2014 16:52:27 +0000 (12:52 -0400)
If virDomainDiskDefFree(disk) is called in 'skipdisk:', then it's possible
to either return to skipdisk without reallocating a new disk (via the if
condition just prior) or to end the loop having deleted the disk. Since
virDomainDiskDefFree() does not pass by reference, disk isn't changed in
this context, thus the possible issue.

src/xenconfig/xen_xm.c

index fe46d9174404392d8e83c8d8296f4a548b7cb447..1e57e2488ee8ab336cd520a4cc275a72fa2aca6a 100644 (file)
@@ -201,6 +201,7 @@ xenParseXMDisk(virConfPtr conf, virDomainDefPtr def, int xendConfigVersion)
             skipdisk:
             list = list->next;
             virDomainDiskDefFree(disk);
+            disk = NULL;
         }
     }