From: Karel Zak Date: Tue, 27 Mar 2012 12:59:01 +0000 (+0200) Subject: eject: use xstrdup() X-Git-Tag: v2.22-rc1~555^2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5e814e3806652c90c70fac4e05880fe6996da04;p=thirdparty%2Futil-linux.git eject: use xstrdup() Signed-off-by: Karel Zak --- diff --git a/misc-utils/eject.c b/misc-utils/eject.c index 502a0fd9d1..a04eee0805 100644 --- a/misc-utils/eject.c +++ b/misc-utils/eject.c @@ -601,7 +601,7 @@ static char *multiple_partitions(const char *name) status = regexec(&preg, name, 1, 0, 0); regfree(&preg); if (status == 0) { - result = (char *) malloc(strlen(name) + 25); + result = xmalloc(strlen(name) + 25); strcpy(result, name); result[strlen(partition_device[i]) + 6] = 0; strcat(result, "([0-9]?[0-9])?$"); @@ -672,7 +672,7 @@ int main(int argc, char **argv) { /* if no device, use default */ if (device == 0) { - device = strdup(defaultDevice); + device = xstrdup(defaultDevice); if (v_option) printf(_("%s: using default device `%s'\n"), programName, device); } @@ -698,7 +698,7 @@ int main(int argc, char **argv) { if (v_option) printf(_("%s: `%s' is a link to `%s'\n"), programName, fullName, linkName); free(fullName); - fullName = strdup(linkName); + fullName = xstrdup(linkName); free(linkName); linkName = 0; ld--; @@ -717,7 +717,7 @@ int main(int argc, char **argv) { printf(_("%s: `%s' is not mounted\n"), programName, fullName); } if (!mounted) { - deviceName = strdup(fullName); + deviceName = xstrdup(fullName); } /* handle -n option */