mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
Remove double OOM error reporting from JSON monitor
The functions called here report an OOM error when the allocation fails, or quietly return -1 on wrong usage (which is not the case here)
This commit is contained in:
parent
c997e45408
commit
fb11f5b185
@ -5220,7 +5220,6 @@ qemuMonitorJSONBuildUnixSocketAddress(const char *path)
|
|||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
error:
|
error:
|
||||||
virReportOOMError();
|
|
||||||
virJSONValueFree(data);
|
virJSONValueFree(data);
|
||||||
virJSONValueFree(addr);
|
virJSONValueFree(addr);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -5415,7 +5414,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
|
|
||||||
if (!(backend = virJSONValueNewObject()) ||
|
if (!(backend = virJSONValueNewObject()) ||
|
||||||
!(data = virJSONValueNewObject())) {
|
!(data = virJSONValueNewObject())) {
|
||||||
goto no_memory;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ((virDomainChrType) chr->type) {
|
switch ((virDomainChrType) chr->type) {
|
||||||
@ -5431,14 +5430,14 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_FILE:
|
case VIR_DOMAIN_CHR_TYPE_FILE:
|
||||||
backend_type = "file";
|
backend_type = "file";
|
||||||
if (virJSONValueObjectAppendString(data, "out", chr->data.file.path) < 0)
|
if (virJSONValueObjectAppendString(data, "out", chr->data.file.path) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_DEV:
|
case VIR_DOMAIN_CHR_TYPE_DEV:
|
||||||
backend_type = STRPREFIX(chrID, "parallel") ? "parallel" : "serial";
|
backend_type = STRPREFIX(chrID, "parallel") ? "parallel" : "serial";
|
||||||
if (virJSONValueObjectAppendString(data, "device",
|
if (virJSONValueObjectAppendString(data, "device",
|
||||||
chr->data.file.path) < 0)
|
chr->data.file.path) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_TCP:
|
case VIR_DOMAIN_CHR_TYPE_TCP:
|
||||||
@ -5447,7 +5446,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
chr->data.tcp.service);
|
chr->data.tcp.service);
|
||||||
if (!addr ||
|
if (!addr ||
|
||||||
virJSONValueObjectAppend(data, "addr", addr) < 0)
|
virJSONValueObjectAppend(data, "addr", addr) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
addr = NULL;
|
addr = NULL;
|
||||||
|
|
||||||
telnet = chr->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
|
telnet = chr->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
|
||||||
@ -5455,7 +5454,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
if (virJSONValueObjectAppendBoolean(data, "wait", false) < 0 ||
|
if (virJSONValueObjectAppendBoolean(data, "wait", false) < 0 ||
|
||||||
virJSONValueObjectAppendBoolean(data, "telnet", telnet) < 0 ||
|
virJSONValueObjectAppendBoolean(data, "telnet", telnet) < 0 ||
|
||||||
virJSONValueObjectAppendBoolean(data, "server", chr->data.tcp.listen) < 0)
|
virJSONValueObjectAppendBoolean(data, "server", chr->data.tcp.listen) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_UDP:
|
case VIR_DOMAIN_CHR_TYPE_UDP:
|
||||||
@ -5464,7 +5463,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
chr->data.udp.connectService);
|
chr->data.udp.connectService);
|
||||||
if (!addr ||
|
if (!addr ||
|
||||||
virJSONValueObjectAppend(data, "addr", addr) < 0)
|
virJSONValueObjectAppend(data, "addr", addr) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
addr = NULL;
|
addr = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5474,12 +5473,12 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
|
|
||||||
if (!addr ||
|
if (!addr ||
|
||||||
virJSONValueObjectAppend(data, "addr", addr) < 0)
|
virJSONValueObjectAppend(data, "addr", addr) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
addr = NULL;
|
addr = NULL;
|
||||||
|
|
||||||
if (virJSONValueObjectAppendBoolean(data, "wait", false) < 0 ||
|
if (virJSONValueObjectAppendBoolean(data, "wait", false) < 0 ||
|
||||||
virJSONValueObjectAppendBoolean(data, "server", chr->data.nix.listen) < 0)
|
virJSONValueObjectAppendBoolean(data, "server", chr->data.nix.listen) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
||||||
@ -5496,7 +5495,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
|
|
||||||
if (virJSONValueObjectAppendString(backend, "type", backend_type) < 0 ||
|
if (virJSONValueObjectAppendString(backend, "type", backend_type) < 0 ||
|
||||||
virJSONValueObjectAppend(backend, "data", data) < 0)
|
virJSONValueObjectAppend(backend, "data", data) < 0)
|
||||||
goto no_memory;
|
goto error;
|
||||||
data = NULL;
|
data = NULL;
|
||||||
|
|
||||||
if (!(ret = qemuMonitorJSONMakeCommand("chardev-add",
|
if (!(ret = qemuMonitorJSONMakeCommand("chardev-add",
|
||||||
@ -5507,8 +5506,6 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
no_memory:
|
|
||||||
virReportOOMError();
|
|
||||||
error:
|
error:
|
||||||
virJSONValueFree(addr);
|
virJSONValueFree(addr);
|
||||||
virJSONValueFree(data);
|
virJSONValueFree(data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user