qemu: Avoid comparing size_t with -1

ncpus would be -1 on error and the cleanup for loop would not be skipped
in this case.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Jiri Denemark 2017-12-11 14:34:20 +01:00
parent 3446750bab
commit fd754cb69c

View File

@ -2965,7 +2965,7 @@ virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon)
size_t i; size_t i;
if ((ncpus = qemuMonitorGetCPUDefinitions(mon, &cpus)) < 0) if ((ncpus = qemuMonitorGetCPUDefinitions(mon, &cpus)) < 0)
goto error; return NULL;
if (!(models = virDomainCapsCPUModelsNew(ncpus))) if (!(models = virDomainCapsCPUModelsNew(ncpus)))
goto error; goto error;