summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--monitor.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/monitor.c b/monitor.c
index 6d040e620f..e0f880107f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3823,7 +3823,6 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
QDict *qdict = NULL;
Monitor *mon = cur_mon;
Error *err = NULL;
- QString *req_json;
req = json_parser_parse_err(tokens, NULL, &err);
if (!req && !err) {
@@ -3841,9 +3840,11 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
qdict_del(qdict, "id");
} /* else will fail qmp_dispatch() */
- req_json = qobject_to_json(req);
- trace_handle_qmp_command(mon, qstring_get_str(req_json));
- QDECREF(req_json);
+ if (trace_event_get_state_backends(TRACE_HANDLE_QMP_COMMAND)) {
+ QString *req_json = qobject_to_json(req);
+ trace_handle_qmp_command(mon, qstring_get_str(req_json));
+ QDECREF(req_json);
+ }
rsp = qmp_dispatch(cur_mon->qmp.commands, req);