]> err.no Git - util-linux/commitdiff
getopt: remove useless if-before-free tests
authorKarel Zak <kzak@redhat.com>
Tue, 24 Feb 2009 15:41:06 +0000 (16:41 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 24 Feb 2009 15:41:06 +0000 (16:41 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
getopt/getopt.c

index 29735e51267a3cfbfb90eec343a761fec8c37318..fbcfb0590d18b96dce911b1ae44c9181e87c7e91 100644 (file)
@@ -114,8 +114,7 @@ const char *normalize(const char *arg)
        const char *argptr=arg;
        char *bufptr;
 
-       if (BUFFER != NULL)
-               free(BUFFER);
+       free(BUFFER);
 
        if (!quote) { /* Just copy arg */
                BUFFER=our_malloc(strlen(arg)+1);
@@ -406,8 +405,7 @@ int main(int argc, char *argv[])
                        print_help();
                        exit(0);
                case 'o':
-                       if (optstr)
-                               free(optstr);
+                       free(optstr);
                        optstr=our_malloc(strlen(optarg)+1);
                        strcpy(optstr,optarg);
                        break;
@@ -415,8 +413,7 @@ int main(int argc, char *argv[])
                        add_long_options(optarg);
                        break;
                case 'n':
-                       if (name)
-                               free(name);
+                       free(name);
                        name=our_malloc(strlen(optarg)+1);
                        strcpy(name,optarg);
                        break;