git » libjio » commit e7abd10

Replace malloc() + strcpy() with strdup()

author Alberto Bertogli
2009-02-25 06:32:37 UTC
committer Alberto Bertogli
2009-02-25 07:48:31 UTC
parent 76715c9ffb5983a40867376f14f0474a9e685208

Replace malloc() + strcpy() with strdup()

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

check.c +1 -2

diff --git a/check.c b/check.c
index b5b095c..251d6a1 100644
--- a/check.c
+++ b/check.c
@@ -147,12 +147,11 @@ int jfsck(const char *name, const char *jdir, struct jfsck_result *res)
 			goto exit;
 		}
 	} else {
-		fs.jdir = (char *) malloc(strlen(jdir) + 1);
+		fs.jdir = strdup(jdir);
 		if (fs.jdir == NULL) {
 			ret = J_ENOMEM;
 			goto exit;
 		}
-		strcpy(fs.jdir, jdir);
 	}
 
 	rv = lstat(fs.jdir, &sinfo);