mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-16 18:25:08 -06:00
dnsmasq.c: Fix OOM error reporting
Also do some indentation clean up.
This commit is contained in:
parent
2b50cae54e
commit
254ade373d
@ -99,9 +99,8 @@ hostsfileAdd(dnsmasqHostsfile *hostsfile,
|
||||
return 0;
|
||||
|
||||
alloc_error:
|
||||
virReportSystemError(ENOMEM,
|
||||
_("Failed to add dhcp host entry: mac=%s, ip=%s, name=%s\n"),
|
||||
mac, ip, (name ? name : "(null)"));
|
||||
virReportOOMError();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -112,14 +111,17 @@ hostsfileNew(const char *name,
|
||||
int err;
|
||||
dnsmasqHostsfile *hostsfile;
|
||||
|
||||
if (VIR_ALLOC(hostsfile) < 0)
|
||||
if (VIR_ALLOC(hostsfile) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hostsfile->hosts = NULL;
|
||||
hostsfile->nhosts = 0;
|
||||
|
||||
if (virAsprintf(&hostsfile->path, "%s/%s.%s", config_dir, name,
|
||||
DNSMASQ_HOSTSFILE_SUFFIX) < 0) {
|
||||
virReportOOMError();
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -240,8 +242,10 @@ dnsmasqContextNew(const char *network_name,
|
||||
{
|
||||
dnsmasqContext *ctx;
|
||||
|
||||
if (VIR_ALLOC(ctx) < 0)
|
||||
if (VIR_ALLOC(ctx) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(ctx->hostsfile = hostsfileNew(network_name, config_dir)))
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user