diff options
| author | Marc-André Lureau | 2016-07-07 20:48:06 +0200 |
|---|---|---|
| committer | Marc-André Lureau | 2016-09-08 15:57:32 +0200 |
| commit | 4ae3c0e27fff7e41fd75fc63a35703bc64785863 (patch) | |
| tree | d352a7dd554d0c821cdcd83f8c02a5b02ee9bc73 | |
| parent | tests: fix test-cutils leaks (diff) | |
| download | qemu-4ae3c0e27fff7e41fd75fc63a35703bc64785863.tar.gz qemu-4ae3c0e27fff7e41fd75fc63a35703bc64785863.tar.xz qemu-4ae3c0e27fff7e41fd75fc63a35703bc64785863.zip | |
tests: fix test-vmstate leaks
Spotted thanks to ASAN.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
| -rw-r--r-- | tests/test-vmstate.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 41fd841aed..d8da26f974 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -50,16 +50,20 @@ static QEMUFile *open_test_file(bool write) { int fd = dup(temp_fd); QIOChannel *ioc; + QEMUFile *f; + lseek(fd, 0, SEEK_SET); if (write) { g_assert_cmpint(ftruncate(fd, 0), ==, 0); } ioc = QIO_CHANNEL(qio_channel_file_new_fd(fd)); if (write) { - return qemu_fopen_channel_output(ioc); + f = qemu_fopen_channel_output(ioc); } else { - return qemu_fopen_channel_input(ioc); + f = qemu_fopen_channel_input(ioc); } + object_unref(OBJECT(ioc)); + return f; } #define SUCCESS(val) \ |
