From: John Ferlan Date: Wed, 27 Aug 2014 11:48:37 +0000 (-0400) Subject: xen_xm: Resolve Coverity USE_AFTER_FREE X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cfbbeb36cf204fb2d87d45c5b8e9e676afefdfcd;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git xen_xm: Resolve Coverity USE_AFTER_FREE 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. --- diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c index fe46d9174..1e57e2488 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; } }