[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/32] qmp: Always free QMPRequest with qmp_request_
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 14/32] qmp: Always free QMPRequest with qmp_request_free() |
Date: |
Mon, 2 Jul 2018 18:22:00 +0200 |
monitor_qmp_dispatch_one() frees a QMPRequest manually, because it
needs to keep a reference to ->id. Premature optimization. Take an
additional reference so we can use qmp_request_free().
Signed-off-by: Markus Armbruster <address@hidden>
---
monitor.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/monitor.c b/monitor.c
index 10991757f6..94f5660c3c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4181,8 +4181,6 @@ static void monitor_qmp_dispatch_one(QMPRequest *req_obj)
id = req_obj->id;
need_resume = req_obj->need_resume;
- g_free(req_obj);
-
old_mon = cur_mon;
cur_mon = mon;
@@ -4191,14 +4189,14 @@ static void monitor_qmp_dispatch_one(QMPRequest
*req_obj)
cur_mon = old_mon;
/* Respond if necessary */
- monitor_qmp_respond(mon, rsp, NULL, id);
+ monitor_qmp_respond(mon, rsp, NULL, qobject_ref(id));
/* This pairs with the monitor_suspend() in handle_qmp_command(). */
if (need_resume) {
monitor_resume(mon);
}
- qobject_unref(req);
+ qmp_request_free(req_obj);
}
/*
--
2.17.1
- Re: [Qemu-devel] [PATCH 05/32] qmp: Get rid of x-oob-test command, (continued)
- [Qemu-devel] [PATCH 21/32] qobject: New qdict_from_jsonf_nofail(), Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 15/32] qmp: Simplify code around monitor_qmp_dispatch_one(), Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 19/32] monitor: Rename use_io_thr to use_io_thread, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 08/32] tests/test-qga: Demonstrate the guest-agent ignores "id", Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 14/32] qmp: Always free QMPRequest with qmp_request_free(),
Markus Armbruster <=
- [Qemu-devel] [PATCH 16/32] tests/qmp-test: Demonstrate QMP errors jumping the queue, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 18/32] qmp: Don't let JSON errors jump the queue, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 12/32] qmp: Redo how the client requests out-of-band execution, Markus Armbruster, 2018/07/02