From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: Fix memory leak on VCPU creation error Date: Sun, 17 Apr 2011 12:16:04 +0300 Message-ID: <4DAAAFD4.3030900@redhat.com> References: <4DA4E128.8070401@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59099 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751593Ab1DQJQI (ORCPT ); Sun, 17 Apr 2011 05:16:08 -0400 In-Reply-To: <4DA4E128.8070401@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On 04/13/2011 02:32 AM, Jan Kiszka wrote: > From: Jan Kiszka > > If kvm_arch_vcpu_setup failed, we leaked the allocated VCPU structure so > far. > @@ -1609,18 +1609,18 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) > > r = kvm_arch_vcpu_setup(vcpu); > if (r) > - return r; > + goto vcpu_destroy; > kvm_arch_vcpu_setup() (at least x86's) does a vcpu->free() on failure. I think the current code is correct (if confusing). -- error compiling committee.c: too many arguments to function