From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52722 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfF4V-0006qE-7o for qemu-devel@nongnu.org; Tue, 18 Jan 2011 12:10:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfF4A-0004vY-CD for qemu-devel@nongnu.org; Tue, 18 Jan 2011 12:10:01 -0500 Received: from moutng.kundenserver.de ([212.227.126.186]:62733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfF49-0004ub-RK for qemu-devel@nongnu.org; Tue, 18 Jan 2011 12:09:58 -0500 Message-ID: <4D35C960.6040703@mail.berlios.de> Date: Tue, 18 Jan 2011 18:09:52 +0100 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] linux-user: Fix possible realloc memory leak References: <1295296566-30287-1-git-send-email-weil@mail.berlios.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Riku Voipio , QEMU Developers Am 18.01.2011 09:26, schrieb Markus Armbruster: > Stefan Weil writes: > >> Extract from "man realloc": >> "If realloc() fails the original block is left untouched; >> it is not freed or moved." >> >> Fix a possible memory leak (reported by cppcheck). >> >> Cc: Riku Voipio >> Signed-off-by: Stefan Weil > > Sidestep the problem via qemu_realloc() instead? The same change was applied to bsd-user/elfload.c. As symbol loading is not essential in most applications, returning after out-of-memory should be better than aborting (that's what qemu_realloc does).