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>
This commit is contained in:
Ján Tomko 2018-06-12 13:38:43 +02:00
parent dfc5696492
commit 2382a23614

View File

@ -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;
}