mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
libqtest: escape strings in QMP commands, fix leak
libqtest is using g_strdup_printf to format QMP commands, but this does not work if the argument strings need to be escaped. Instead, use the fancy %-formatting functionality of QObject. The only change required in tests is that strings have to be formatted as %s, not '%s' or \"%s\". Luckily this usage of parameterized QMP commands is not that frequent. The leak is in socket_sendf. Since we are extracting the send loop to a new function, fix it now. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8ffad850ef
commit
563890c7c7
4 changed files with 43 additions and 16 deletions
|
@ -291,7 +291,7 @@ static void test_media_insert(void)
|
|||
/* Insert media in drive. DSKCHK should not be reset until a step pulse
|
||||
* is sent. */
|
||||
qmp_discard_response("{'execute':'change', 'arguments':{"
|
||||
" 'device':'floppy0', 'target': '%s' }}",
|
||||
" 'device':'floppy0', 'target': %s }}",
|
||||
test_image);
|
||||
qmp_discard_response(""); /* ignore event
|
||||
(FIXME open -> open transition?!) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue