@@ -694,7 +694,7 @@ struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino,
return NULL;
}
- pp = path = strdup(p);
+ pp = path = xstrdup(p);
if (*path == '/') {
path++;
@@ -469,7 +469,7 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
} else {
/* If parent is NULL (happens with device table entries),
* try and find our parent now) */
- tmp = strdup(name);
+ tmp = xstrdup(name);
dir = dirname(tmp);
parent = find_filesystem_entry(root, dir, S_IFDIR);
free(tmp);
@@ -534,7 +534,7 @@ static int get_options(int argc, char**argv)
return err_msg("bad maximum LEB count");
break;
case 'o':
- output = strdup(optarg);
+ output = xstrdup(optarg);
break;
case 'D':
tbl_file = optarg;
@@ -627,7 +627,7 @@ static int get_options(int argc, char**argv)
}
if (optind != argc && !output)
- output = strdup(argv[optind]);
+ output = xstrdup(argv[optind]);
if (!output)
return err_msg("not output device or file specified");
@@ -159,10 +159,7 @@ static void process_options(int argc, char * const argv[])
start_addr = simple_strtoll(optarg, &error);
break;
case 'f':
- if (!(dumpfile = strdup(optarg))) {
- perror("stddup");
- exit(EXIT_FAILURE);
- }
+ dumpfile = xstrdup(optarg);
break;
case 'l':
length = simple_strtoll(optarg, &error);
These call sites either assume there is no failure (they deref the pointer right away), or the exit themselves. Use xstrdup() instead. Signed-off-by: Mike Frysinger <vapier@gentoo.org> --- jffs2reader.c | 2 +- mkfs.jffs2.c | 2 +- mkfs.ubifs/mkfs.ubifs.c | 4 ++-- nanddump.c | 5 +---- 4 files changed, 5 insertions(+), 8 deletions(-)