about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-10 07:58:39 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-10 07:58:39 +0000
commitecf359c68b2baf1bd76f8c5ff132b8c1a256056b (patch)
tree9486b342395098b2f4412704bd3726c973edbec8 /posix
parent400cc70af5972a50618702da02d18aee845ce542 (diff)
downloadglibc-ecf359c68b2baf1bd76f8c5ff132b8c1a256056b.tar.gz
glibc-ecf359c68b2baf1bd76f8c5ff132b8c1a256056b.tar.xz
glibc-ecf359c68b2baf1bd76f8c5ff132b8c1a256056b.zip
* posix/wordexp.c: Remove numerous NULL pointer tests before FREE
	calls.
Diffstat (limited to 'posix')
-rw-r--r--posix/wordexp.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 8dc07067c0..188e710037 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1167,9 +1167,8 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
 	return WRDE_NOSPACE;
     }
 
-  /* Premature end */
-  if (comm)
-    free (comm);
+  /* Premature end.  */
+  free (comm);
 
   return WRDE_SYNTAX;
 }
@@ -1430,8 +1429,7 @@ envsubst:
 			      &buffer[20], 10, 0);
 	  *word = w_addstr (*word, word_length, max_length, value);
 	  free (env);
-	  if (pattern)
-	    free (pattern);
+	  free (pattern);
 	  return *word ? 0 : WRDE_NOSPACE;
 	}
       /* Is it `$*' or `$@' (unquoted) ? */
@@ -1604,8 +1602,7 @@ envsubst:
 		      if (free_value)
 			free (value);
 
-		      if (expanded)
-			free (expanded);
+		      free (expanded);
 
 		      goto do_error;
 		    }
@@ -1625,8 +1622,7 @@ envsubst:
 		      if (free_value)
 			free (value);
 
-		      if (expanded)
-			free (expanded);
+		      free (expanded);
 
 		      goto do_error;
 		    }
@@ -1648,8 +1644,7 @@ envsubst:
 		goto no_space;
 	    }
 
-	  if (pattern)
-		  free (pattern);
+	  free (pattern);
 
 	  pattern = expanded;
 	}
@@ -1863,7 +1858,7 @@ envsubst:
 	      goto success;
 	    }
 
-	  if (free_value && value)
+	  if (free_value)
 	    free (value);
 
 	  value = pattern ? __strdup (pattern) : pattern;
@@ -1880,8 +1875,10 @@ envsubst:
 	}
     }
 
-  free (env); env = NULL;
-  free (pattern); pattern = NULL;
+  free (env);
+  env = NULL;
+  free (pattern);
+  pattern = NULL;
 
   if (seen_hash)
     {
@@ -1996,11 +1993,9 @@ syntax:
   error = WRDE_SYNTAX;
 
 do_error:
-  if (env)
-    free (env);
+  free (env);
 
-  if (pattern)
-    free (pattern);
+  free (pattern);
 
   return error;
 }
@@ -2448,8 +2443,7 @@ do_error:
    *	set pwordexp members back to what they were.
    */
 
-  if (word != NULL)
-    free (word);
+  free (word);
 
   if (error == WRDE_NOSPACE)
     return WRDE_NOSPACE;