mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lib: fix memory leak of query_kvm in guestfs_int_platform_has_kvm (#316)
The string allocated by generic_qmp_test via safe_strdup is passed to parse_has_kvm but never freed afterwards, leaking memory on every KVM capability check. Use CLEANUP_FREE to ensure automatic cleanup. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -193,7 +193,7 @@ parse_has_kvm (guestfs_h *g, const char *json)
|
||||
int
|
||||
guestfs_int_platform_has_kvm (guestfs_h *g)
|
||||
{
|
||||
char *query_kvm;
|
||||
CLEANUP_FREE char *query_kvm = NULL;
|
||||
|
||||
if (generic_qmp_test (g, "query-kvm", &query_kvm) == -1)
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user