From: Cong Ding <dinggnu@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>, Jiri Kosina <jkosina@suse.cz>,
Jesper Juhl <jj@codesealer.com>,
linux-kernel@vger.kernel.org
Cc: Cong Ding <dinggnu@gmail.com>
Subject: [PATCH] usr/gen_init_cpio.c: remove unnecessary "if"
Date: Tue, 18 Dec 2012 22:26:38 +0100 [thread overview]
Message-ID: <1355866000-18295-1-git-send-email-dinggnu@gmail.com> (raw)
usr/gen_init_cpio.c: remove unnecessary "if"
if it goes to fail, dname isn't allocated; otherwise, it is allocated
successfully. so we just free memory when it doesn't fail.
this patch also fix a trival trailing space warning by checkpatch
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
usr/gen_init_cpio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index af8c925..afebe09 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -372,7 +372,7 @@ static int cpio_mkfile(const char *name, const char *location,
}
ino++;
rc = 0;
-
+
error:
if (filebuf) free(filebuf);
if (file >= 0) close(file);
@@ -452,8 +452,8 @@ static int cpio_mkfile_line(const char *line)
}
rc = cpio_mkfile(dname, cpio_replace_env(location),
mode, uid, gid, nlinks);
+ free(dname);
fail:
- if (dname_len) free(dname);
return rc;
}
--
1.7.10.4
next reply other threads:[~2012-12-18 21:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 21:26 Cong Ding [this message]
[not found] ` <CAGXu5jL6od7Mpm3NPDD-wyo8cZGmOY8HZwpkVBaSPc61Z+TxOA@mail.gmail.com>
2012-12-18 22:03 ` [PATCH] usr/gen_init_cpio.c: remove unnecessary "if" Kees Cook
2012-12-18 22:41 ` Cong Ding
2012-12-18 22:50 ` Cong Ding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355866000-18295-1-git-send-email-dinggnu@gmail.com \
--to=dinggnu@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jj@codesealer.com \
--cc=jkosina@suse.cz \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox