Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752191Ab0KEFom (ORCPT ); Fri, 5 Nov 2010 01:44:42 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:39517 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751192Ab0KEFok (ORCPT ); Fri, 5 Nov 2010 01:44:40 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=RfwZy0eT2+RICgLYspJEUsIzAaqHwMAeTeMEkNly6xSQUpIOiJUjv3VlRDG3UdyAV4 fah+V7bdD91vqelw8ITf56X4s/gGClXuOaYy2OglPidmnPNLaKHow94PNMnd4vXi9N05 pk/JnbQtoX5KPV1YTdDwnaAf4zOJ7bSLBcUoA= MIME-Version: 1.0 Date: Fri, 5 Nov 2010 13:44:38 +0800 Message-ID: Subject: [PATCH] kdb: fix memory leak From: jovi zhang To: Jason Wessel , Martin Hicks , Dmitry Torokhov , Andrew Morton , Rusty Russell , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id oA55iwFn000768 Content-Length: 1639 Lines: 47 fix memory leak in kdb_main.c Signed-off-by: jovi zhang kernel/debug/kdb/kdb_main.c |   13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 37755d6..3ab3fee 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -2361,7 +2361,7 @@ static int kdb_pid(int argc, const char **argv)  */ static int kdb_ll(int argc, const char **argv) { -       int diag; +       int diag = 0;        unsigned long addr;        long offset = 0;        unsigned long va; @@ -2400,20 +2400,21 @@ static int kdb_ll(int argc, const char **argv)                char buf[80];                if (KDB_FLAG(CMD_INTERRUPT)) -                       return 0; +                       goto out;                sprintf(buf, "%s " kdb_machreg_fmt "\n", command, va);                diag = kdb_parse(buf);                if (diag) -                       return diag; +                       goto out;                addr = va + linkoffset;                if (kdb_getword(&va, addr, sizeof(va))) -                       return 0; +                       goto out;        } -       kfree(command); -       return 0; +out: +       kfree(command); +       return diag; } static int kdb_kgdb(int argc, const char **argv) ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?