From 41b015523f37cd523159329ea505f4381348b0a1 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 24 Feb 2009 16:41:06 +0100 Subject: [PATCH] getopt: remove useless if-before-free tests Signed-off-by: Karel Zak --- getopt/getopt.c | 9 +++------ 1 file 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; -- 2.39.5