]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
system/qtest: add missing qtest_finalize()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 27 Apr 2026 10:54:00 +0000 (14:54 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 11 May 2026 19:59:33 +0000 (23:59 +0400)
Free owned resources on object finalization.

Fixes: 6ba7ada3559e ("qtest: add a QOM object for qtest")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
system/qtest.c

index cf90cd53adbeeac6a74ae0e3064c230a5d6f665e..a79d10d1361552cff57ca67be3341ed693f866a7 100644 (file)
@@ -1020,10 +1020,20 @@ static void qtest_class_init(ObjectClass *oc, const void *data)
                                   qtest_get_log, qtest_set_log);
 }
 
+static void qtest_finalize(Object *obj)
+{
+    QTest *q = QTEST(obj);
+
+    g_free(q->chr_name);
+    g_free(q->log);
+    object_unref(q->chr);
+}
+
 static const TypeInfo qtest_info = {
     .name = TYPE_QTEST,
     .parent = TYPE_OBJECT,
     .class_init = qtest_class_init,
+    .instance_finalize = qtest_finalize,
     .instance_size = sizeof(QTest),
     .interfaces = (const InterfaceInfo[]) {
         { TYPE_USER_CREATABLE },