aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorMiaoqian Lin <linmq006@gmail.com>2022-06-24 10:31:59 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2022-07-08 11:03:36 +0200
commitf696b74b15f641c23c3f1aa644a3f2a98c0a87e1 (patch)
tree5a554e4b8ad40ef72cfd496db77fd8311d2e2576 /accel
parentd2bfbdf316b215ab94858738091cc93d46f27d8c (diff)
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: cc01a3f4cadd ("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>
Diffstat (limited to 'accel')
-rw-r--r--accel/kvm/kvm-all.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index ba3210b1c1..ed8b6b896e 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -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;