2008-09-03 05:53:55

by Manish Katiyar

[permalink] [raw]
Subject: [PATCH] debugfs : Fix memory leaks in do_ncheck()

Below patch fixes memory leaks in do_ncheck(). Also use this
opportunity to fix the progname printed as "ncheck" instead of
"do_ncheck" since all other messages
in this file do so.


Signed-off-by: "Manish Katiyar" <[email protected]>

---
debugfs/ncheck.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/debugfs/ncheck.c b/debugfs/ncheck.c
index 3381dd9..22529c4 100644
--- a/debugfs/ncheck.c
+++ b/debugfs/ncheck.c
@@ -76,7 +76,7 @@ void do_ncheck(int argc, char **argv)

iw.iarray = malloc(sizeof(struct inode_info) * argc);
if (!iw.iarray) {
- com_err("do_ncheck", ENOMEM,
+ com_err("ncheck", ENOMEM,
"while allocating inode info array");
return;
}
@@ -86,7 +86,7 @@ void do_ncheck(int argc, char **argv)
iw.iarray[i-1].ino = strtol(argv[i], &tmp, 0);
if (*tmp) {
com_err(argv[0], 0, "Bad inode - %s", argv[i]);
- return;
+ goto error_out;
}
}

--
1.5.4.3


Thanks -
Manish


2008-09-05 14:36:41

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] debugfs : Fix memory leaks in do_ncheck()

On Wed, Sep 03, 2008 at 11:23:53AM +0530, Manish Katiyar wrote:
> Below patch fixes memory leaks in do_ncheck(). Also use this
> opportunity to fix the progname printed as "ncheck" instead of
> "do_ncheck" since all other messages
> in this file do so.

Applied, thanks.

- Ted