Coverity determined that on error path that 'mach' wouldn't be free'd
Since virCapabilitiesFreeGuestMachine() isn't globally available, we'll
insert first and then if the VIR_STRDUP's fail they it will eventually
cause the 'mach' to be freed in the error path
virCapsGuestMachinePtr mach;
if (VIR_ALLOC(mach) < 0)
goto error;
+ (*machines)[i] = mach;
if (qemuCaps->machineAliases[i]) {
if (VIR_STRDUP(mach->name, qemuCaps->machineAliases[i]) < 0 ||
VIR_STRDUP(mach->canonical, qemuCaps->machineTypes[i]) < 0)
goto error;
}
mach->maxCpus = qemuCaps->machineMaxCpus[i];
- (*machines)[i] = mach;
}
return 0;