File 2382a236-fix-qemuDomainGetSEVMeasurement-leak.patch of Package libvirt.11329
commit 2382a23614d259c08825dea745e5e726e6744824
Author: Ján Tomko <jtomko@redhat.com>
Date: Tue Jun 12 13:38:43 2018 +0200
qemuDomainGetSEVMeasurement: fix possible leak
Free tmp even on failure.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
Tested-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Index: libvirt-4.0.0/src/qemu/qemu_driver.c
===================================================================
--- libvirt-4.0.0.orig/src/qemu/qemu_driver.c
+++ libvirt-4.0.0/src/qemu/qemu_driver.c
@@ -21208,7 +21208,7 @@ qemuDomainGetSEVMeasurement(virQEMUDrive
unsigned int flags)
{
int ret = -1;
- char *tmp;
+ char *tmp = NULL;
int maxpar = 0;
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
@@ -21231,10 +21231,10 @@ qemuDomainGetSEVMeasurement(virQEMUDrive
tmp) < 0)
goto endjob;
- VIR_FREE(tmp);
ret = 0;
endjob:
+ VIR_FREE(tmp);
qemuDomainObjEndJob(driver, vm);
return ret;
}