
+ info = calloc(max, sizeof(*info)); + if (info == NULL) { + CU_DEBUG("Failed to allocate %i vcpuinfo structures", max); + return -1; + } + + count = virDomainGetVcpus(dom, info, max, NULL, 0); + + free(info);
KR> You free info here..
+ + for (i = 0; i < count; i++) { + if (info[i].cpu != -1)
KR> But use one of its fields in the compare here. Yeah, that would be bad. What happened was, I didn't realize at first that we had to actually examine the .cpu field of the struct to get a count of *active* vcpus, so I initially was just returning count. Later, I added the loop to count the active ones, and clearly added it after the free() instead of before :) I'll send a replacement. Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com