提交 4ae3c0e2 编写于 作者: M Marc-André Lureau

tests: fix test-vmstate leaks

Spotted thanks to ASAN.
Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 d6f723b5
......@@ -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) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册