* [gentoo-commits] proj/qemu-kvm:qemu-kvm-1.2.0-gentoo commit in: qom/
@ 2013-01-19 2:27 Doug Goldstein
0 siblings, 0 replies; 2+ messages in thread
From: Doug Goldstein @ 2013-01-19 2:27 UTC (permalink / raw
To: gentoo-commits
commit: fa830675f2d112a33b81d5345b07ad609d3e922e
Author: Paolo Bonzini <pbonzini <AT> redhat <DOT> com>
AuthorDate: Fri Nov 23 15:56:17 2012 +0000
Commit: Doug Goldstein <cardoe <AT> gentoo <DOT> org>
CommitDate: Thu Dec 13 21:31:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/qemu-kvm.git;a=commit;h=fa830675
qom: dynamic_cast of NULL is always NULL
Trying to cast a NULL value will cause a crash. Returning
NULL is also sensible, and it is also what the type-unsafe
DO_UPCAST macro does.
Reported-by: Markus Armbruster <armbru <AT> redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini <AT> redhat.com>
Signed-off-by: Anthony Liguori <aliguori <AT> us.ibm.com>
(cherry picked from commit b7f43fe46029d8fd0594cd599fa2599dcce0f553)
Signed-off-by: Michael Roth <mdroth <AT> linux.vnet.ibm.com>
(cherry picked from commit 5e19e498b4b2a31c985dc96b1aff078c34e40488)
---
qom/object.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index e3e9242..f33e84d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -417,7 +417,7 @@ void object_delete(Object *obj)
Object *object_dynamic_cast(Object *obj, const char *typename)
{
- if (object_class_dynamic_cast(object_get_class(obj), typename)) {
+ if (obj && object_class_dynamic_cast(object_get_class(obj), typename)) {
return obj;
}
@@ -430,7 +430,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename)
inst = object_dynamic_cast(obj, typename);
- if (!inst) {
+ if (!inst && obj) {
fprintf(stderr, "Object %p is not an instance of type %s\n",
obj, typename);
abort();
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/qemu-kvm:qemu-kvm-1.2.0-gentoo commit in: qom/
@ 2013-01-19 2:27 Doug Goldstein
0 siblings, 0 replies; 2+ messages in thread
From: Doug Goldstein @ 2013-01-19 2:27 UTC (permalink / raw
To: gentoo-commits
commit: 8a08672c2c2e5243ee03bb0b43f19c0539191477
Author: Paolo Bonzini <pbonzini <AT> redhat <DOT> com>
AuthorDate: Fri Nov 23 08:47:12 2012 +0000
Commit: Doug Goldstein <cardoe <AT> gentoo <DOT> org>
CommitDate: Thu Dec 13 21:31:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/qemu-kvm.git;a=commit;h=8a08672c
qom: fix refcount of non-heap-allocated objects
The reference count for embedded objects is always one too low, because
object_initialize_with_type returns with zero references to the object.
This causes premature finalization of the object (or an assertion failure)
after calling object_ref to add an extra reference and object_unref to
remove it.
The fix is to move the initial object_ref call from object_new_with_type
to object_initialize_with_type.
Acked-by: Andreas Färber <afaerber <AT> suse.de>
Signed-off-by: Paolo Bonzini <pbonzini <AT> redhat.com>
Signed-off-by: Anthony Liguori <aliguori <AT> us.ibm.com>
(cherry picked from commit 764b63125a77dab54ed405d493452a4e05679c2e)
Signed-off-by: Michael Roth <mdroth <AT> linux.vnet.ibm.com>
(cherry picked from commit f05a3da4e00d24c4540811e6fff2c4f0484771bd)
---
qom/object.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index f33e84d..5499318 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -307,6 +307,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
memset(obj, 0, type->instance_size);
obj->class = type->class;
+ object_ref(obj);
QTAILQ_INIT(&obj->properties);
object_init_with_type(obj, type);
}
@@ -395,7 +396,6 @@ Object *object_new_with_type(Type type)
obj = g_malloc(type->instance_size);
object_initialize_with_type(obj, type);
- object_ref(obj);
return obj;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-19 2:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-19 2:27 [gentoo-commits] proj/qemu-kvm:qemu-kvm-1.2.0-gentoo commit in: qom/ Doug Goldstein
-- strict thread matches above, loose matches on Subject: below --
2013-01-19 2:27 Doug Goldstein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox