diff options
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/hmp.c | 8 | ||||
-rw-r--r-- | monitor/monitor.c | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/monitor/hmp.c b/monitor/hmp.c index 944fa9651e..d598dd02bb 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1399,12 +1399,16 @@ static void monitor_readline_flush(void *opaque) monitor_flush(&mon->common); } -void monitor_init_hmp(Chardev *chr, bool use_readline) +void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp) { MonitorHMP *mon = g_new0(MonitorHMP, 1); + if (!qemu_chr_fe_init(&mon->common.chr, chr, errp)) { + g_free(mon); + return; + } + monitor_data_init(&mon->common, false, false, false); - qemu_chr_fe_init(&mon->common.chr, chr, &error_abort); mon->use_readline = use_readline; if (mon->use_readline) { diff --git a/monitor/monitor.c b/monitor/monitor.c index 00d287655e..2282bf6780 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -631,7 +631,7 @@ int monitor_init(MonitorOptions *opts, Error **errp) warn_report("'pretty' is deprecated for HMP monitors, it has no " "effect and will be removed in future versions"); } - monitor_init_hmp(chr, true); + monitor_init_hmp(chr, true, &local_err); break; default: g_assert_not_reached(); |