[PATCH 03/10] xen_xm: Resolve Coverity USE_AFTER_FREE

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

 



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.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/xenconfig/xen_xm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c
index fe46d91..1e57e24 100644
--- a/src/xenconfig/xen_xm.c
+++ b/src/xenconfig/xen_xm.c
@@ -201,6 +201,7 @@ xenParseXMDisk(virConfPtr conf, virDomainDefPtr def, int xendConfigVersion)
             skipdisk:
             list = list->next;
             virDomainDiskDefFree(disk);
+            disk = NULL;
         }
     }
 
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]