container: don't leak container reference
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 14 Dec 2016 19:42:55 +0000 (22:42 +0300)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 4 May 2017 11:34:41 +0000 (15:34 +0400)
object_property_add_child() references the child, unref it after to
avoid ref leaks.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
qom/container.c

index c9eb49b01edb3a373366c159da0e57b318231933..f6ccaf7ea780349e9fac89dea8384cfc0f6fb429 100644 (file)
@@ -40,6 +40,7 @@ Object *container_get(Object *root, const char *path)
         if (!child) {
             child = object_new("container");
             object_property_add_child(obj, parts[i], child, NULL);
+            object_unref(child);
         }
     }