[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/55] test-char: Destroy chardev correctly at char_file_test_inte
From: |
Paolo Bonzini |
Subject: |
[PULL 13/55] test-char: Destroy chardev correctly at char_file_test_internal() |
Date: |
Mon, 21 Dec 2020 15:44:05 +0100 |
From: Eduardo Habkost <ehabkost@redhat.com>
commit 1e419ee68fa5 ("chardev: generate an internal id when none
given") changed the reference ownership semantics of
qemu_chardev_new(NULL, ...): now all chardevs created using
qemu_chardev_new() are added to the /chardevs QOM container, and
the caller does not own a reference to the newly created object.
However, the code at char_file_test_internal() had not been
updated and was calling object_unref() on a chardev object it
didn't own. This makes the chardev be destroyed, but leaves a
dangling pointer in the /chardev container children list, and
seems to be the cause of the following char_serial_test() crash:
Unexpected error in object_property_try_add() at ../qom/object.c:1220: \
attempt to add duplicate property 'serial-id' to object (type 'container')
ERROR test-char - too few tests run (expected 38, got 9)
Update the code to use object_unparent() at the end of
char_file_test_internal(), to make sure the chardev will be
correctly removed from the QOM tree.
Fixes: 1e419ee68fa5 ("chardev: generate an internal id when none given")
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20201215224133.3545901-2-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/test-char.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test-char.c b/tests/test-char.c
index 953e0d1c1f..06102977b6 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -1298,7 +1298,7 @@ static void char_file_test_internal(Chardev *ext_chr,
const char *filepath)
g_assert(strncmp(contents, "hello!", 6) == 0);
if (!ext_chr) {
- object_unref(OBJECT(chr));
+ object_unparent(OBJECT(chr));
g_unlink(out);
}
g_free(contents);
--
2.29.2
- [PULL 39/55] glusterfs: convert to meson, (continued)
- [PULL 39/55] glusterfs: convert to meson, Paolo Bonzini, 2020/12/21
- [PULL 15/55] target/i386: Check privilege level for protected mode 'int N' task gate, Paolo Bonzini, 2020/12/21
- [PULL 18/55] check-block: enable iotests with cfi-icall, Paolo Bonzini, 2020/12/21
- [PULL 19/55] configure,meson: support Control-Flow Integrity, Paolo Bonzini, 2020/12/21
- [PULL 20/55] docs: Add CFI Documentation, Paolo Bonzini, 2020/12/21
- [PULL 29/55] meson: use pkg-config method for libudev, Paolo Bonzini, 2020/12/21
- [PULL 25/55] Makefile: add dummy target for build.ninja dependencies, Paolo Bonzini, 2020/12/21
- [PULL 43/55] libssh: convert to meson, Paolo Bonzini, 2020/12/21
- [PULL 48/55] zstd: convert to meson, Paolo Bonzini, 2020/12/21
- [PULL 50/55] virtfs: convert to meson, Paolo Bonzini, 2020/12/21
- [PULL 13/55] test-char: Destroy chardev correctly at char_file_test_internal(),
Paolo Bonzini <=
- [PULL 35/55] configure: remove CONFIG_FILEVERSION and CONFIG_PRODUCTVERSION, Paolo Bonzini, 2020/12/21
- [PULL 27/55] meson: switch minimum meson version to 0.56.0, Paolo Bonzini, 2020/12/21
- [PULL 55/55] win32: drop fd registration to the main-loop on setting non-block, Paolo Bonzini, 2020/12/21
- [PULL 32/55] configure: remove useless code to check for Xen PCI passthrough, Paolo Bonzini, 2020/12/21
- [PULL 37/55] curl: remove compatibility code, require 7.29.0, Paolo Bonzini, 2020/12/21
- [PULL 36/55] brlapi: convert to meson, Paolo Bonzini, 2020/12/21
- [PULL 30/55] meson: use dependency to gate block modules, Paolo Bonzini, 2020/12/21
- [PULL 09/55] tests/docker: Remove the remainders of debian9 containers from the Makefile, Paolo Bonzini, 2020/12/21
- [PULL 23/55] util: Extract flush_icache_range to cacheflush.c, Paolo Bonzini, 2020/12/21
- [PULL 34/55] configure: accept --enable-slirp, Paolo Bonzini, 2020/12/21