Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753906Ab0KGX2b (ORCPT ); Sun, 7 Nov 2010 18:28:31 -0500 Received: from ozlabs.org ([203.10.76.45]:41868 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753878Ab0KGX23 (ORCPT ); Sun, 7 Nov 2010 18:28:29 -0500 From: Rusty Russell To: virtualization@lists.linux-foundation.org Subject: Re: [PATCH] Char: virtio_console, fix memory leak Date: Mon, 8 Nov 2010 09:58:22 +1030 User-Agent: KMail/1.13.5 (Linux/2.6.35-22-generic-pae; KDE/4.5.1; i686; ; ) Cc: Jiri Slaby , jirislaby@gmail.com, Amit Shah , "Greg Kroah-Hartman" , linux-kernel@vger.kernel.org References: <1289034412-24278-1-git-send-email-jslaby@suse.cz> <1289034412-24278-2-git-send-email-jslaby@suse.cz> In-Reply-To: <1289034412-24278-2-git-send-email-jslaby@suse.cz> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011080958.23163.rusty@rustcorp.com.au> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 695 Lines: 18 On Sat, 6 Nov 2010 07:36:50 pm Jiri Slaby wrote: > Stanse found that in init_vqs, memory is leaked under certain > circumstanses (the fail path order is incorrect). Fix that by checking > allocations in one turn and free all of them at once if some fails > (some may be NULL, but this is OK). Good catch, thanks! I generally prefer the static rather than lazy method of cleanup, but in this case it's ugly both before and after... Applied, Rusty. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/