summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2009-02-24 16:41:06 +0100
committerKarel Zak <kzak@redhat.com>2009-02-24 16:41:06 +0100
commit41b015523f37cd523159329ea505f4381348b0a1 (patch)
tree266d8a1bc14472e14b98513f16b6935eba782295
parent7009077bd2d7a8149848caf64665716ba80dccfb (diff)
downloadutil-linux-old-41b015523f37cd523159329ea505f4381348b0a1.tar.gz
getopt: remove useless if-before-free tests
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--getopt/getopt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/getopt/getopt.c b/getopt/getopt.c
index 29735e51..fbcfb059 100644
--- a/getopt/getopt.c
+++ b/getopt/getopt.c
@@ -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;