qemu: hotplug: Don't leak 'nodename' in qemuDomainChangeMediaBlockdev

qemuDomainDiskGetBackendAlias allocates a copy of the nodename string so
we need to free it at the end.

Found by Coverity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Peter Krempa 2018-08-22 13:09:50 +02:00
parent c86735e2d8
commit 8aced2ea32

View File

@ -700,6 +700,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriverPtr driver,
cleanup:
qemuHotplugDiskSourceDataFree(newbackend);
qemuHotplugDiskSourceDataFree(oldbackend);
VIR_FREE(nodename);
/* caller handles correct exchange of sources */
disk->src = oldsrc;
return ret;