]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/core/resetcontainer: free children array on finalization
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 27 Apr 2026 10:47:44 +0000 (14:47 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 11 May 2026 19:59:33 +0000 (23:59 +0400)
resettable_container_init allocates a GPtrArray for children, but
resettable_container_finalize was empty and never freed it.

Fixes: 4c046ce37af0 ("hw/core: Add ResetContainer which holds objects implementing Resettable")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
hw/core/resetcontainer.c

index ef84aa2374a536fd91c6a7b13ec3cb2dc6688d2b..a4a6476a0363ee3dcd9f5d51e2d4a60b98fdca08 100644 (file)
@@ -66,6 +66,9 @@ static void resettable_container_init(Object *obj)
 
 static void resettable_container_finalize(Object *obj)
 {
+    ResettableContainer *rc = RESETTABLE_CONTAINER(obj);
+
+    g_ptr_array_unref(rc->children);
 }
 
 static void resettable_container_class_init(ObjectClass *klass,