fix memory leak in kdb_main.c

Signed-off-by: jovi zhang <[email protected]>
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)
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to