virtio-balloon: fix virtio-balloon child refcount in transports
authorGonglei <arei.gonglei@huawei.com>
Tue, 30 Sep 2014 06:10:35 +0000 (14:10 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Sep 2014 09:09:31 +0000 (11:09 +0200)
commit91ba21208839643603e7f7fa5864723c3f371ebe
tree3e347c66549490c3e8d5fe0683475064dbd745d7
parent352fa88dfb2e9c72fa2a1506acb39f349d4befbf
virtio-balloon: fix virtio-balloon child refcount in transports

object_initialize() leaves the object with a refcount of 1.
object_property_add_child() adds its own reference which is dropped
again when the property is deleted.

The upshot of this is that we always have a refcount >= 1.  Upon hot
unplug the virtio-balloon child is not finalized!

Drop our reference after the child property has been added to the
parent.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/s390x/virtio-ccw.c
hw/virtio/virtio-pci.c