From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRJWg-0005kB-58 for qemu-devel@nongnu.org; Tue, 09 Sep 2014 07:24:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRJWa-0006cW-2Y for qemu-devel@nongnu.org; Tue, 09 Sep 2014 07:23:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRJWZ-0006cL-RY for qemu-devel@nongnu.org; Tue, 09 Sep 2014 07:23:52 -0400 Message-ID: <540EE33D.2050302@redhat.com> Date: Tue, 09 Sep 2014 13:23:41 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v7 RESEND 6/8] exec: file_ram_alloc: don't exit if failed to preallocate memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , qemu-devel@nongnu.org Cc: Yasunori Goto , Peter Crosthwaite , Yasuaki Isimatu , "Michael S. Tsirkin" Il 09/09/2014 07:27, Hu Tao ha scritto: > diff --git a/exec.c b/exec.c > index 2b9c4c5..0362cd8 100644 > --- a/exec.c > +++ b/exec.c > @@ -1129,8 +1129,8 @@ static void *file_ram_alloc(RAMBlock *block, > return area; > > error: > - if (mem_prealloc) { > - exit(1); > + if (area && area != MAP_FAILED) { > + munmap(area, memory); > } "area" is being used uninitialized here, and os_mem_prealloc can still do exit(1). I'm not sure what this patch is doing... Paolo > return NULL;