[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/55] qom: Assert that objects being destroyed have no parent
From: |
Paolo Bonzini |
Subject: |
[PULL 14/55] qom: Assert that objects being destroyed have no parent |
Date: |
Mon, 21 Dec 2020 15:44:06 +0100 |
From: Eduardo Habkost <ehabkost@redhat.com>
QOM reference counting bugs are often hard to detect, but there's
one kind of bug that's easier: if we are freeing an object but is
still attached to a parent, it means the reference count is wrong
(because the parent always hold a reference to their children).
Add an assertion to make sure we detect those cases.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20201215224133.3545901-3-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qom/object.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/qom/object.c b/qom/object.c
index f2ae6e6b2a..5cfed6d7c6 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -685,6 +685,7 @@ static void object_finalize(void *data)
object_deinit(obj, ti);
g_assert(obj->ref == 0);
+ g_assert(obj->parent == NULL);
if (obj->free) {
obj->free(obj);
}
--
2.29.2
- [PULL 10/55] tests: update for rename of CentOS8 PowerTools repo, (continued)
- [PULL 10/55] tests: update for rename of CentOS8 PowerTools repo, Paolo Bonzini, 2020/12/21
- [PULL 06/55] gitlab: add --without-default-features build, Paolo Bonzini, 2020/12/21
- [PULL 08/55] gitlab-CI: Test 32-bit builds with the fedora-i386-cross container, Paolo Bonzini, 2020/12/21
- [PULL 12/55] vl: initialize displays _after_ exiting preconfiguration, Paolo Bonzini, 2020/12/21
- [PULL 21/55] build-sys: fix -static linking of libvhost-user, Paolo Bonzini, 2020/12/21
- [PULL 24/55] trace: do not include TCG helper tracepoints in no-TCG builds, Paolo Bonzini, 2020/12/21
- [PULL 31/55] meson: cleanup Kconfig.host handling, Paolo Bonzini, 2020/12/21
- [PULL 38/55] curl: convert to meson, Paolo Bonzini, 2020/12/21
- [PULL 11/55] configure: document --without-default-{features, devices}, Paolo Bonzini, 2020/12/21
- [PULL 07/55] tests/tcg: build tests with -Werror, Paolo Bonzini, 2020/12/21
- [PULL 14/55] qom: Assert that objects being destroyed have no parent,
Paolo Bonzini <=
- [PULL 16/55] configure,meson: add option to enable LTO, Paolo Bonzini, 2020/12/21
- [PULL 17/55] cfi: Initial support for cfi-icall in QEMU, Paolo Bonzini, 2020/12/21
- [PULL 33/55] configure: remove variable bogus_os, Paolo Bonzini, 2020/12/21
- [PULL 40/55] bzip2: convert to meson, Paolo Bonzini, 2020/12/21
- [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