From: Ulrich Drepper Date: Wed, 10 May 2006 07:58:39 +0000 (+0000) Subject: * posix/wordexp.c: Remove numerous NULL pointer tests before FREE X-Git-Tag: upstream/2.30~15523 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ecf359c68b2baf1bd76f8c5ff132b8c1a256056b;p=external%2Fglibc.git * posix/wordexp.c: Remove numerous NULL pointer tests before FREE calls. --- diff --git a/ChangeLog b/ChangeLog index feb50d1..fbb7a3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-05-09 Ulrich Drepper + * posix/wordexp.c: Remove numerous NULL pointer tests before FREE + calls. + * io/ftw.c (open_dir_stream): Return right away if REALLOC fails. [Coverity CID 229, 230] diff --git a/posix/wordexp.c b/posix/wordexp.c index 8dc0706..188e710 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; diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 224381c..a78c670 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1042,7 +1042,6 @@ gaih_inet (const char *name, const struct gaih_service *service, else socklen = sizeof (struct sockaddr_in); - struct addrinfo *pai_1st = pai; for (st2 = st; st2 != NULL; st2 = st2->next) { struct addrinfo *ai;