STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
strchr(net->ifname, '%')) {
VIR_FREE(net->ifname);
- if (!(net->ifname = strdup(VIR_NET_GENERATED_PREFIX "%d")))
- goto no_memory;
+ if (VIR_STRDUP(net->ifname, VIR_NET_GENERATED_PREFIX "%d") < 0)
+ goto error;
/* avoid exposing vnet%d in getXMLDesc or error outputs */
template_ifname = true;
}
return 0;
-no_memory:
- virReportOOMError();
error:
return -1;
}
if (vm->def->os.cmdline) {
char *args, *next_arg;
char *cmdline;
- if ((cmdline = strdup(vm->def->os.cmdline)) == NULL)
- goto no_memory;
+ if (VIR_STRDUP(cmdline, vm->def->os.cmdline) < 0)
+ goto error;
args = cmdline;
while (*args == ' ')
if (res && STRPREFIX(res, "pts:")) {
VIR_FREE(def->source.data.file.path);
- if ((def->source.data.file.path = strdup(res + 4)) == NULL) {
- virReportOOMError();
+ if (VIR_STRDUP(def->source.data.file.path, res + 4) < 0) {
VIR_FREE(res);
VIR_FREE(cmd);
return -1;
"%s/log/libvirt/uml", LOCALSTATEDIR) == -1)
goto out_of_memory;
- if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
- goto out_of_memory;
+ if (VIR_STRDUP(base, SYSCONFDIR "/libvirt") < 0)
+ goto error;
if (virAsprintf(¨_driver->monitorDir,
"%s/run/libvirt/uml-guest", LOCALSTATEDIR) == -1)
goto cleanup;
}
- if (!(type = strdup(vm->def->os.type)))
- virReportOOMError();
+ ignore_value(VIR_STRDUP(type, vm->def->os.type));
cleanup:
if (vm)