]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
eject: use xstrdup()
authorKarel Zak <kzak@redhat.com>
Tue, 27 Mar 2012 12:59:01 +0000 (14:59 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Mar 2012 12:59:01 +0000 (14:59 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/eject.c

index 502a0fd9d18c74437502f5c9681ea139f5aeee9e..a04eee0805a9a84ddc2969360c408238320e7a76 100644 (file)
@@ -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 */