diff options
author | Jovi Zhang <bookjovi@gmail.com> | 2010-11-10 07:22:18 -0600 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-11-17 13:54:57 -0600 |
commit | 85e76ab50aecbdc9011806f2f8943450ccb0d93c (patch) | |
tree | 3cf312d0b247a7e2cc40cc5a4bfb35759aa57dda /kernel/debug | |
parent | e53beacd23d9cb47590da6a7a7f6d417b941a994 (diff) |
kdb: fix memory leak in kdb_main.c
Call kfree in the error path as well as the success path in kdb_ll().
Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'kernel/debug')
-rw-r--r-- | 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 37755d621924..3ab3feee7840 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) |