if (loader &&
(guest->arch.defaultInfo.loader = strdup(loader)) == NULL)
goto no_memory;
- if (nmachines) {
- guest->arch.defaultInfo.nmachines = nmachines;
- guest->arch.defaultInfo.machines = machines;
- }
if (VIR_REALLOC_N(caps->guests,
caps->nguests + 1) < 0)
caps->guests[caps->nguests] = guest;
caps->nguests++;
+ if (nmachines) {
+ guest->arch.defaultInfo.nmachines = nmachines;
+ guest->arch.defaultInfo.machines = machines;
+ }
+
return guest;
no_memory:
if (loader &&
(dom->info.loader = strdup(loader)) == NULL)
goto no_memory;
- if (nmachines) {
- dom->info.nmachines = nmachines;
- dom->info.machines = machines;
- }
if (VIR_REALLOC_N(guest->arch.domains,
guest->arch.ndomains + 1) < 0)
guest->arch.domains[guest->arch.ndomains] = dom;
guest->arch.ndomains++;
+ if (nmachines) {
+ dom->info.nmachines = nmachines;
+ dom->info.machines = machines;
+ }
return dom;
virBufferVSprintf(&buf, ",vifname=%s",
net->ifname);
+ if (virBufferError(&buf))
+ goto cleanup;
+
if (VIR_ALLOC(val) < 0) {
virReportOOMError(conn);
goto cleanup;
}
}
- if (testOOM)
- virAllocTestInit();
-
- /* Run once to count allocs, and ensure it passes :-) */
+ /* Run once to prime any static allocations & ensure it passes */
ret = (func)(argc, argv);
if (ret != EXIT_SUCCESS)
goto cleanup;
testOOM++;
virSetErrorFunc(NULL, virtTestErrorFuncQuiet);
+ virAllocTestInit();
+
+ /* Run again to count allocs, and ensure it passes :-) */
+ ret = (func)(argc, argv);
+ if (ret != EXIT_SUCCESS)
+ goto cleanup;
+
approxAlloc = virAllocTestCount();
testCounter++;
if (testDebug)