accel: kvm: Fix memory leak in find_stats_descriptors
This function doesn't release descriptors in one error path,
result in memory leak. Call g_free() to release it.
Fixes: cc01a3f4ca
("kvm: Support for querying fd-based stats")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Message-Id: <20220624063159.57411-1-linmq006@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
d2bfbdf316
commit
f696b74b15
@ -3891,6 +3891,7 @@ static StatsDescriptors *find_stats_descriptors(StatsTarget target, int stats_fd
|
||||
error_setg(errp, "KVM stats: failed to read stats header: "
|
||||
"expected %zu actual %zu",
|
||||
sizeof(*kvm_stats_header), ret);
|
||||
g_free(descriptors);
|
||||
return NULL;
|
||||
}
|
||||
size_desc = sizeof(*kvm_stats_desc) + kvm_stats_header->name_size;
|
||||
|
Loading…
Reference in New Issue
Block a user