kvm: fix memory leak on failure to read stats descriptors
commit21adec30f62e4e700e0e217da756723e189d7b29
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 5 Sep 2022 10:06:02 +0000 (5 12:06 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 18 Sep 2022 07:17:40 +0000 (18 09:17 +0200)
tree7f8ce70d9d34d452888e35254d0c094b16d3c017
parent958e1dd1300f37f18b2161dfb4eb806fc8c19b44
kvm: fix memory leak on failure to read stats descriptors

Reported by Coverity as CID 1490142.  Since the size is constant and the
lifetime is the same as the StatsDescriptors struct, embed the struct
directly instead of using a separate allocation.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/kvm/kvm-all.c