[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/20] hmp: Call visit_end_struct() after visit_start
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 09/20] hmp: Call visit_end_struct() after visit_start_struct() succeeds |
Date: |
Fri, 16 May 2014 11:30:24 -0400 |
From: Markus Armbruster <address@hidden>
When visit_start_struct() succeeds, visit_end_struct() must be called.
hmp_object_add() doesn't when a member visit fails. As far as I can
tell, the opts visitor copes okay with the misuse. Fix it anyway.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
hmp.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/hmp.c b/hmp.c
index 5c4d612..a9d0236 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1388,6 +1388,7 @@ void hmp_netdev_del(Monitor *mon, const QDict *qdict)
void hmp_object_add(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
+ Error *err_end = NULL;
QemuOpts *opts;
char *type = NULL;
char *id = NULL;
@@ -1411,24 +1412,23 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
qdict_del(pdict, "qom-type");
visit_type_str(opts_get_visitor(ov), &type, "qom-type", &err);
if (err) {
- goto out_clean;
+ goto out_end;
}
qdict_del(pdict, "id");
visit_type_str(opts_get_visitor(ov), &id, "id", &err);
if (err) {
- goto out_clean;
+ goto out_end;
}
object_add(type, id, pdict, opts_get_visitor(ov), &err);
- if (err) {
- goto out_clean;
- }
- visit_end_struct(opts_get_visitor(ov), &err);
- if (err) {
+
+out_end:
+ visit_end_struct(opts_get_visitor(ov), &err_end);
+ if (!err && err_end) {
qmp_object_del(id, NULL);
}
-
+ error_propagate(&err, err_end);
out_clean:
opts_visitor_cleanup(ov);
--
1.9.0
- [Qemu-devel] [PULL 00/20] QMP queue, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 01/20] qapi: Update qapi-code-gen.txt example to match current code, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 14/20] monitor: Convert sendkey to use command_completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 13/20] qapi: Show qapi-commands.py invocation in qapi-code-gen.txt, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 20/20] qapi: skip redundant includes, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 11/20] tests: Don't call visit_end_struct() after visit_start_struct() fails, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 08/20] qapi: Un-inline visit of implicit struct, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 09/20] hmp: Call visit_end_struct() after visit_start_struct() succeeds,
Luiz Capitulino <=
- [Qemu-devel] [PULL 17/20] monitor: Add set_link arguments completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 16/20] monitor: Add chardev-add backend argument completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 15/20] monitor: Add chardev-remove command completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 19/20] monitor: Add netdev_del id argument completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 06/20] qapi: Clean up shadowing of parameters and locals in inner scopes, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 18/20] monitor: Add netdev_add type argument completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 12/20] qapi: Replace uncommon use of the error API by the common one, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 03/20] qapi: Remove unused Visitor callbacks start_handle(), end_handle(), Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 05/20] qapi-visit.py: Clean up confusing push_indent() / pop_indent() use, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 10/20] hw: Don't call visit_end_struct() after visit_start_struct() fails, Luiz Capitulino, 2014/05/16