return -1;
}
- *string = strdup(value->str);
-
- if (*string == NULL) {
- virReportOOMError();
- return -1;
- }
-
- return 0;
+ return VIR_STRDUP(*string, value->str);
}
def->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY;
/* def:os */
- def->os.type = strdup("hvm");
-
- if (def->os.type == NULL) {
- virReportOOMError();
+ if (VIR_STRDUP(def->os.type, "hvm") < 0)
goto cleanup;
- }
/* vmx:guestOS -> def:os.arch */
if (virVMXGetConfigString(conf, "guestOS", &guestOS, true) < 0) {
if (STRCASEEQ(virtualDev, "vmxnet") && features == 15) {
VIR_FREE(virtualDev);
- virtualDev = strdup("vmxnet2");
-
- if (virtualDev == NULL) {
- virReportOOMError();
+ if (VIR_STRDUP(virtualDev, "vmxnet2") < 0)
goto cleanup;
- }
}
}
true) < 0)
goto cleanup;
- if (networkName == NULL) {
- networkName = strdup("");
- if (networkName == NULL) {
- virReportOOMError();
- goto cleanup;
- }
- }
+ if (!networkName && VIR_STRDUP(networkName, "") < 0)
+ goto cleanup;
}
/* vmx:vnet -> def:data.ifname */
goto cleanup;
}
- (*def)->source.data.tcp.host = strdup(parsedUri->server);
-
- if ((*def)->source.data.tcp.host == NULL) {
- virReportOOMError();
+ if (VIR_STRDUP((*def)->source.data.tcp.host, parsedUri->server) < 0)
goto cleanup;
- }
if (virAsprintf(&(*def)->source.data.tcp.service, "%d",
parsedUri->port) < 0) {