Skip to content

Commit

Permalink
kdb: fix memory leak in kdb_main.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jovi Zhang authored and jwessel committed Nov 17, 2010
1 parent e53beac commit 85e76ab
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions kernel/debug/kdb/kdb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 85e76ab

Please sign in to comment.