]> git.ipfire.org Git - thirdparty/qemu.git/commit
qom: Avoid leaking str and bool properties on failure
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 4 Mar 2014 14:28:18 +0000 (15:28 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 25 Jun 2014 20:11:17 +0000 (15:11 -0500)
commit7e42cd6f35a48b20651eb84894ba8df9039e7ccb
tree27f9b6476191f49eb083aafeab27a9126dfbead5
parent4f577e9e69c0ac8befd75d67ca591398e4994719
qom: Avoid leaking str and bool properties on failure

When object_property_add_str() and object_property_add_bool() fail, they
leak their internal StringProperty and BoolProperty structs.  Remember
to free the structs on error.

Luckily this is a low-impact memory leak since most QOM properties are
static qdev properties that will never take the error case.
object_property_add() only fails if the property name is already in use.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from commit a01aedc8d32e6f5b08a4041b62be3c5fab7a3382)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qom/object.c