From: Marc-André Lureau <[email protected]>
The result list built by x86_cpu_list_feature_names() was never freed
after being visited, causing a memory leak detected by ASan.
(the getter visitor is VISITOR_OUTPUT kind and doesn't own data)
Fixes: 506174bf8219 ("i386: "unavailable-features" QOM property")
Signed-off-by: Marc-André Lureau <[email protected]>
Link:
https://lore.kernel.org/r/[email protected]
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
(cherry picked from commit 87e1226e6f6844845ac407d50198d84205e7ed7f)
Signed-off-by: Michael Tokarev <[email protected]>
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 9401258a54..de9a0973d9 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6221,6 +6221,7 @@ static void x86_cpu_get_unavailable_features(Object *obj,
Visitor *v,
x86_cpu_list_feature_names(xc->filtered_features, &result);
visit_type_strList(v, "unavailable-features", &result, errp);
+ qapi_free_strList(result);
}
/* Print all cpuid feature names in featureset
--
2.47.3