lkml.org 
[lkml]   [2012]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usr/gen_init_cpio.c: remove unnecessary "if"
Date
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


\
 
 \ /
  Last update: 2012-12-18 23:01    [W:0.044 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site