From 560f19f162529d691619ac69ed032321c7f5f1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 7 Jun 2017 20:35:54 +0400 Subject: object: fix potential leak in getters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the property is not of the requested type, the getters will leak a QObject. Signed-off-by: Marc-André Lureau Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Message-Id: <20170607163635.17635-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- qom/object.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'qom') diff --git a/qom/object.c b/qom/object.c index eb4bc92..c7b8079 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1122,7 +1122,7 @@ char *object_property_get_str(Object *obj, const char *name, retval = g_strdup(qstring_get_str(qstring)); } - QDECREF(qstring); + qobject_decref(ret); return retval; } @@ -1183,7 +1183,7 @@ bool object_property_get_bool(Object *obj, const char *name, retval = qbool_get_bool(qbool); } - QDECREF(qbool); + qobject_decref(ret); return retval; } @@ -1214,7 +1214,7 @@ int64_t object_property_get_int(Object *obj, const char *name, retval = qint_get_int(qint); } - QDECREF(qint); + qobject_decref(ret); return retval; } -- cgit v1.1