From 2382a23614d259c08825dea745e5e726e6744824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 12 Jun 2018 13:38:43 +0200 Subject: [PATCH] qemuDomainGetSEVMeasurement: fix possible leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Free tmp even on failure. Signed-off-by: Ján Tomko Reviewed-by: Brijesh Singh Tested-by: Brijesh Singh Reviewed-by: Daniel P. Berrangé --- src/qemu/qemu_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7c79c324e6..42069ee617 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21503,7 +21503,7 @@ qemuDomainGetSEVMeasurement(virQEMUDriverPtr driver, unsigned int flags) { int ret = -1; - char *tmp; + char *tmp = NULL; int maxpar = 0; virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); @@ -21526,10 +21526,10 @@ qemuDomainGetSEVMeasurement(virQEMUDriverPtr driver, tmp) < 0) goto endjob; - VIR_FREE(tmp); ret = 0; endjob: + VIR_FREE(tmp); qemuDomainObjEndJob(driver, vm); return ret; } -- GitLab