提交 410cbafe 编写于 作者: Y Yoshiaki Tamura 提交者: Luiz Capitulino

net: delete QemuOpts when net_client_init() fails.

This fixes the following scenario using QMP.

First, put a bogus argument "foo" to "type", which results in an error.
{"execute": "netdev_add", "arguments": { "type": "foo", "id": "netdev1" } }
Then, call it again with correct argument "user".
{"execute": "netdev_add", "arguments": { "type": "user", "id": "netdev1" } }
This results in "DuplicatedId" error.

Because the first command was invalid, it should be able to reuse the
same "id", and the second command should work.
Reported-by: NLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: NYoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 bbafc7a8
......@@ -1208,6 +1208,10 @@ int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
}
res = net_client_init(mon, opts, 1);
if (res < 0) {
qemu_opts_del(opts);
}
return res;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册