diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 07:58:39 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 07:58:39 +0000 |
commit | ecf359c68b2baf1bd76f8c5ff132b8c1a256056b (patch) | |
tree | 9486b342395098b2f4412704bd3726c973edbec8 | |
parent | 400cc70af5972a50618702da02d18aee845ce542 (diff) | |
download | glibc-ecf359c68b2baf1bd76f8c5ff132b8c1a256056b.tar.gz glibc-ecf359c68b2baf1bd76f8c5ff132b8c1a256056b.tar.xz glibc-ecf359c68b2baf1bd76f8c5ff132b8c1a256056b.zip |
* posix/wordexp.c: Remove numerous NULL pointer tests before FREE
calls.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | posix/wordexp.c | 34 | ||||
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 1 |
3 files changed, 17 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog index feb50d1f2e..fbb7a3b9ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-05-09 Ulrich Drepper <drepper@redhat.com> + * 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 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; diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 224381c8db..a78c670bfb 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; |