diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2015-03-11 17:41:01 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-03-16 12:13:56 +0100 |
commit | 29c655c0a6affc0359e499162e8308663eb4d04f (patch) | |
tree | ed6b1fc761dee6623ec1b312cc53dc3b661c1550 /lib/multi.c | |
parent | 059b3a5770075315dbc843b9285a1cdec82c12d5 (diff) |
Bug #149: Deletion of unnecessary checks before calls of the function "free"
The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first
This issue was fixed by using the software Coccinelle 1.0.0-rc24.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Diffstat (limited to 'lib/multi.c')
-rw-r--r-- | lib/multi.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/multi.c b/lib/multi.c index 6d21b138d..88e81c631 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -217,8 +217,7 @@ static void sh_freeentry(void *freethis) { struct Curl_sh_entry *p = (struct Curl_sh_entry *) freethis; - if(p) - free(p); + free(p); } static size_t fd_key_compare(void *k1, size_t k1_len, void *k2, size_t k2_len) @@ -1582,8 +1581,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, if(!retry) { /* if the URL is a follow-location and not just a retried request then figure out the URL here */ - if(newurl) - free(newurl); + free(newurl); newurl = data->req.newurl; data->req.newurl = NULL; follow = FOLLOW_REDIR; @@ -1608,8 +1606,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* but first check to see if we got a location info even though we're not following redirects */ if(data->req.location) { - if(newurl) - free(newurl); + free(newurl); newurl = data->req.location; data->req.location = NULL; result = Curl_follow(data, newurl, FOLLOW_FAKE); @@ -1624,8 +1621,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } } - if(newurl) - free(newurl); + free(newurl); break; } |