mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
kvm: debugfs: fix memory leak in kvm_create_vm_debugfs
In commitbc9e9e672d
("KVM: debugfs: Reuse binary stats descriptors") loop for filling debugfs_stat_data was copy-pasted 2 times, but in the second loop pointers are saved over pointers allocated in the first loop. All this causes is a memory leak, fix it. Fixes:bc9e9e672d
("KVM: debugfs: Reuse binary stats descriptors") Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Reviewed-by: Jing Zhang <jingzhangos@google.com> Message-Id: <20210701195500.27097-1-paskripkin@gmail.com> Reviewed-by: Jing Zhang <jingzhangos@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7234c362cc
commit
004d62eb4e
@ -935,7 +935,7 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
|
||||
stat_data->kvm = kvm;
|
||||
stat_data->desc = pdesc;
|
||||
stat_data->kind = KVM_STAT_VCPU;
|
||||
kvm->debugfs_stat_data[i] = stat_data;
|
||||
kvm->debugfs_stat_data[i + kvm_vm_stats_header.num_desc] = stat_data;
|
||||
debugfs_create_file(pdesc->name, kvm_stats_debugfs_mode(pdesc),
|
||||
kvm->debugfs_dentry, stat_data,
|
||||
&stat_fops_per_vm);
|
||||
|
Loading…
Reference in New Issue
Block a user