diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-06-13 09:35:18 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-07-01 10:20:41 +0200 |
commit | 563890c7c7e977842e2a35afe7a24d06d2103242 (patch) | |
tree | 284a26ca2bcd81b2e0abada9e9838c2be325086c /tests/fdc-test.c | |
parent | 8ffad850ef5ae14287d0e185d478c9a35820482c (diff) |
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>
Diffstat (limited to 'tests/fdc-test.c')
-rw-r--r-- | tests/fdc-test.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 37096dcc13..c8e1e7bd18 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -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?!) */ |