[Qemu-devel] [PATCH 03/21] object: fix potential leak in getters

Marc-André Lureau posted 21 patches 8 years, 8 months ago
[Qemu-devel] [PATCH 03/21] object: fix potential leak in getters
Posted by Marc-André Lureau 8 years, 8 months ago
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>
Cc: qemu-trivial@nongnu.org
---
 qom/object.c | 6 +++---
 1 file 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;
 }
 
-- 
2.12.0.191.gc5d8de91d


Re: [Qemu-devel] [PATCH 03/21] object: fix potential leak in getters
Posted by Eric Blake 8 years, 7 months ago
On 03/11/2017 07:22 AM, Marc-André Lureau wrote:
> 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>
> Cc: qemu-trivial@nongnu.org
> ---
>  qom/object.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

This one should be safe for 2.9.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Re: [Qemu-devel] [PATCH 03/21] object: fix potential leak in getters
Posted by Michael Tokarev 8 years, 6 months ago
11.03.2017 16:22, Marc-André Lureau wrote:
> If the property is not of the requested type, the getters will leak a
> QObject.

I'm not really sure it's -trivial material.

Not applying 01/23 either.

Should whole series be applied to the same tree perhaps?

Thanks,

/mjt