If something goes wrong in testDomainGetDiskErrors() then we try
to free any strings that were previously allocated in return
array. Problem is, in my review of original patch (
89320788ac4)
I've mistakenly did some changes which result in possible NULL
dereference (@vm is set to NULL as the first thing under cleanup
label).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
virCheckFlags(0, -1);
if (!(vm = testDomObjFromDomain(dom)))
- goto cleanup;
+ return -1;
if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
}
cleanup:
- virDomainObjEndAPI(&vm);
if (ret < 0) {
for (i = 0; i < MIN(vm->def->ndisks, maxerrors); i++)
VIR_FREE(errors[i].disk);
}
+ virDomainObjEndAPI(&vm);
return ret;
}