aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2015-03-11 17:41:01 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-16 12:13:56 +0100
commit29c655c0a6affc0359e499162e8308663eb4d04f (patch)
treeed6b1fc761dee6623ec1b312cc53dc3b661c1550 /tests/libtest
parent059b3a5770075315dbc843b9285a1cdec82c12d5 (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 'tests/libtest')
-rw-r--r--tests/libtest/lib539.c3
-rw-r--r--tests/libtest/lib568.c3
-rw-r--r--tests/libtest/lib569.c4
-rw-r--r--tests/libtest/lib570.c4
-rw-r--r--tests/libtest/lib571.c4
-rw-r--r--tests/libtest/lib572.c3
-rw-r--r--tests/libtest/lib582.c6
7 files changed, 8 insertions, 19 deletions
diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c
index 923893fb2..053d29806 100644
--- a/tests/libtest/lib539.c
+++ b/tests/libtest/lib539.c
@@ -83,8 +83,7 @@ int test(char *URL)
test_cleanup:
curl_slist_free_all(slist);
- if(newURL)
- free(newURL);
+ free(newURL);
curl_easy_cleanup(curl);
curl_global_cleanup();
diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c
index 12fc5e5d9..b6f5ab7ca 100644
--- a/tests/libtest/lib568.c
+++ b/tests/libtest/lib568.c
@@ -159,8 +159,7 @@ test_cleanup:
if(sdpf)
fclose(sdpf);
- if(stream_uri)
- free(stream_uri);
+ free(stream_uri);
if(custom_headers)
curl_slist_free_all(custom_headers);
diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c
index 222f1e024..bc4887276 100644
--- a/tests/libtest/lib569.c
+++ b/tests/libtest/lib569.c
@@ -115,9 +115,7 @@ test_cleanup:
if(idfile)
fclose(idfile);
- if(stream_uri)
- free(stream_uri);
-
+ free(stream_uri);
curl_easy_cleanup(curl);
curl_global_cleanup();
diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c
index 93ccab8ea..178f58f96 100644
--- a/tests/libtest/lib570.c
+++ b/tests/libtest/lib570.c
@@ -102,9 +102,7 @@ int test(char *URL)
}
test_cleanup:
-
- if(stream_uri)
- free(stream_uri);
+ free(stream_uri);
curl_easy_cleanup(curl);
curl_global_cleanup();
diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c
index 3270300de..d8dad396b 100644
--- a/tests/libtest/lib571.c
+++ b/tests/libtest/lib571.c
@@ -195,9 +195,7 @@ int test(char *URL)
}
test_cleanup:
-
- if(stream_uri)
- free(stream_uri);
+ free(stream_uri);
if(protofile)
fclose(protofile);
diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c
index 9b23c01a2..fd547b8b3 100644
--- a/tests/libtest/lib572.c
+++ b/tests/libtest/lib572.c
@@ -165,8 +165,7 @@ test_cleanup:
if(paramsf)
fclose(paramsf);
- if(stream_uri)
- free(stream_uri);
+ free(stream_uri);
if(custom_headers)
curl_slist_free_all(custom_headers);
diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c
index 952efb4ed..4c3ea6f60 100644
--- a/tests/libtest/lib582.c
+++ b/tests/libtest/lib582.c
@@ -357,10 +357,8 @@ test_cleanup:
fclose(hd_src);
/* free local memory */
- if(sockets.read.sockets)
- free(sockets.read.sockets);
- if(sockets.write.sockets)
- free(sockets.write.sockets);
+ free(sockets.read.sockets);
+ free(sockets.write.sockets);
return res;
}