system/qtest: add missing qtest_finalize()
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>
Marc-André Lureau committed
Apr 27, 2026 at 14:54 UTC
ec3979bfe804c2d585e3945094f13e3ff036a5d0
1 file changed
+10
system/qtest.c
+10
@@ -1020,10 +1020,20 @@ static void qtest_class_init(ObjectClass *oc, const void *data)
1020
qtest_get_log, qtest_set_log);
1021
}
1022
1023
+static void qtest_finalize(Object *obj)
1024
+{
1025
+ QTest *q = QTEST(obj);
1026
+
1027
+ g_free(q->chr_name);
1028
+ g_free(q->log);
1029
+ object_unref(q->chr);
1030
+}
1031
+
1032
static const TypeInfo qtest_info = {
1033
.name = TYPE_QTEST,
1034
.parent = TYPE_OBJECT,
1035
.class_init = qtest_class_init,
1036
+ .instance_finalize = qtest_finalize,
1037
.instance_size = sizeof(QTest),
1038
.interfaces = (const InterfaceInfo[]) {
1039
{ TYPE_USER_CREATABLE },