From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1QerX3-0005UA-4z for user-mode-linux-devel@lists.sourceforge.net; Thu, 07 Jul 2011 16:34:29 +0000 Received: from mail-bw0-f46.google.com ([209.85.214.46]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1QerX2-0004r9-Ee for user-mode-linux-devel@lists.sourceforge.net; Thu, 07 Jul 2011 16:34:29 +0000 Received: by bwd5 with SMTP id 5so1636899bwd.33 for ; Thu, 07 Jul 2011 09:34:22 -0700 (PDT) From: Vitaliy Ivanov Date: Thu, 07 Jul 2011 19:36:02 +0300 Message-ID: <1310056562.3528.49.camel@vivanov> Mime-Version: 1.0 List-Id: The user-mode Linux development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: user-mode-linux-devel-bounces@lists.sourceforge.net Subject: [uml-devel] [PATCH 1/3] uml: drivers/net_user.c memory leak fix To: Jeff Dike , Richard Weinberger Cc: vitalivanov@gmail.com, LKML , user-mode-linux-devel@lists.sourceforge.net >>>From 9b9f36f46aa708c3245f5ded83f96421966b2edf Mon Sep 17 00:00:00 2001 From: Vitaliy Ivanov Date: Thu, 7 Jul 2011 19:23:13 +0300 Subject: [PATCH 1/3] uml: drivers/net_user.c memory leak fix Perform memory cleanup on exit. On receiving invalid 'pid' we still should clean 'output' variable. Signed-off-by: Vitaliy Ivanov --- arch/um/drivers/net_user.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 9415dd9..989b653 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c @@ -228,10 +228,11 @@ static void change(char *dev, char *what, unsigned char *addr, "buffer\n"); pid = change_tramp(argv, output, output_len); - if (pid < 0) return; if (output != NULL) { - printk("%s", output); + if (pid >= 0) { + printk("%s", output); + } kfree(output); } } -- 1.7.0.4 ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752889Ab1GGQeY (ORCPT ); Thu, 7 Jul 2011 12:34:24 -0400 Received: from mail-bw0-f52.google.com ([209.85.214.52]:53040 "EHLO mail-bw0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880Ab1GGQeX (ORCPT ); Thu, 7 Jul 2011 12:34:23 -0400 Subject: [PATCH 1/3] uml: drivers/net_user.c memory leak fix From: Vitaliy Ivanov To: Jeff Dike , Richard Weinberger Cc: user-mode-linux-devel@lists.sourceforge.net, LKML , vitalivanov@gmail.com Content-Type: text/plain; charset="UTF-8" Date: Thu, 07 Jul 2011 19:36:02 +0300 Message-ID: <1310056562.3528.49.camel@vivanov> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>From 9b9f36f46aa708c3245f5ded83f96421966b2edf Mon Sep 17 00:00:00 2001 From: Vitaliy Ivanov Date: Thu, 7 Jul 2011 19:23:13 +0300 Subject: [PATCH 1/3] uml: drivers/net_user.c memory leak fix Perform memory cleanup on exit. On receiving invalid 'pid' we still should clean 'output' variable. Signed-off-by: Vitaliy Ivanov --- arch/um/drivers/net_user.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index 9415dd9..989b653 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c @@ -228,10 +228,11 @@ static void change(char *dev, char *what, unsigned char *addr, "buffer\n"); pid = change_tramp(argv, output, output_len); - if (pid < 0) return; if (output != NULL) { - printk("%s", output); + if (pid >= 0) { + printk("%s", output); + } kfree(output); } } -- 1.7.0.4