aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-07 20:35:54 +0400
committerMarkus Armbruster <armbru@redhat.com>2017-06-19 14:56:29 +0200
commit560f19f162529d691619ac69ed032321c7f5f1fb (patch)
tree5252e26b143e8992e39107a31202a08282c572d1 /qom
parenta2740ad584839ac84f3cdb2d928de93a0d7f4e72 (diff)
object: fix potential leak in getters
If the property is not of the requested type, the getters will leak a QObject. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170607163635.17635-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/qom/object.c b/qom/object.c
index eb4bc924ff..c7b8079df6 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;
}