We allocate temporary kernel buffers for these structures, but never free them.
Signed-off-by: Avi Kivity <avi@redhat.com>
        void __user *argp = (void __user *)arg;
        int r;
        struct kvm_lapic_state *lapic = NULL;
+       struct kvm_xsave *xsave = NULL;
+       struct kvm_xcrs *xcrs = NULL;
 
        switch (ioctl) {
        case KVM_GET_LAPIC: {
                break;
        }
        case KVM_GET_XSAVE: {
-               struct kvm_xsave *xsave;
-
                xsave = kzalloc(sizeof(struct kvm_xsave), GFP_KERNEL);
                r = -ENOMEM;
                if (!xsave)
                break;
        }
        case KVM_SET_XSAVE: {
-               struct kvm_xsave *xsave;
-
                xsave = kzalloc(sizeof(struct kvm_xsave), GFP_KERNEL);
                r = -ENOMEM;
                if (!xsave)
                break;
        }
        case KVM_GET_XCRS: {
-               struct kvm_xcrs *xcrs;
-
                xcrs = kzalloc(sizeof(struct kvm_xcrs), GFP_KERNEL);
                r = -ENOMEM;
                if (!xcrs)
                break;
        }
        case KVM_SET_XCRS: {
-               struct kvm_xcrs *xcrs;
-
                xcrs = kzalloc(sizeof(struct kvm_xcrs), GFP_KERNEL);
                r = -ENOMEM;
                if (!xcrs)
        }
 out:
        kfree(lapic);
+       kfree(xsave);
+       kfree(xcrs);
        return r;
 }