diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2014-03-19 08:58:57 +0100 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-03-19 22:23:47 +0100 |
commit | abdffd1fb78c1b98bda925d3d59123beca6761a3 (patch) | |
tree | 2eccb0dca91eb017d45abdf184a562b09f980940 /hw/virtio | |
parent | 39f72ef94ba74701d18daf82b44c18a60f94eb60 (diff) | |
download | qemu-abdffd1fb78c1b98bda925d3d59123beca6761a3.zip qemu-abdffd1fb78c1b98bda925d3d59123beca6761a3.tar.gz qemu-abdffd1fb78c1b98bda925d3d59123beca6761a3.tar.bz2 |
virtio-rng: Avoid default_backend refcount leak
QOM child properties take a reference to the object and release it when
the property is deleted. Therefore we should unref the default_backend
after we have added it as a child property.
Cc: KONRAD Frederic <fred.konrad@greensocs.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/virtio')
-rw-r--r-- | hw/virtio/virtio-rng.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index cbf0138..b6ab361 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -162,6 +162,9 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp) OBJECT(vrng->conf.default_backend), NULL); + /* The child property took a reference, we can safely drop ours now */ + object_unref(OBJECT(vrng->conf.default_backend)); + object_property_set_link(OBJECT(dev), OBJECT(vrng->conf.default_backend), "rng", NULL); |