aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib1537.c
diff options
context:
space:
mode:
authorMarian Klymov <nekto1989@gmail.com>2018-06-02 23:52:56 +0300
committerDaniel Stenberg <daniel@haxx.se>2018-06-11 11:14:48 +0200
commitc45360d4633850839bb9c2d77dbf8a8285e9ad49 (patch)
tree20159c553a74ed98c2431fc8f2852067f79ac4e9 /tests/libtest/lib1537.c
parent38203f1585da53e07e54e37c7d5da4d72f509a2e (diff)
cppcheck: fix warnings
- Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
Diffstat (limited to 'tests/libtest/lib1537.c')
-rw-r--r--tests/libtest/lib1537.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/libtest/lib1537.c b/tests/libtest/lib1537.c
index b07d64fc5..9832c3a30 100644
--- a/tests/libtest/lib1537.c
+++ b/tests/libtest/lib1537.c
@@ -43,8 +43,7 @@ int test(char *URL)
asize = (int)sizeof(a);
ptr = curl_easy_escape(NULL, (char *)a, asize);
printf("%s\n", ptr);
- if(ptr)
- curl_free(ptr);
+ curl_free(ptr);
/* deprecated API */
ptr = curl_escape((char *)a, asize);
@@ -58,8 +57,7 @@ int test(char *URL)
printf("outlen == %d\n", outlen);
printf("unescape == original? %s\n",
memcmp(raw, a, outlen) ? "no" : "YES");
- if(raw)
- curl_free(raw);
+ curl_free(raw);
/* deprecated API */
raw = curl_unescape(ptr, (int)strlen(ptr));
@@ -71,10 +69,8 @@ int test(char *URL)
printf("[old] outlen == %d\n", outlen);
printf("[old] unescape == original? %s\n",
memcmp(raw, a, outlen) ? "no" : "YES");
- if(raw)
- curl_free(raw);
- if(ptr)
- curl_free(ptr);
+ curl_free(raw);
+ curl_free(ptr);
/* weird input length */
ptr = curl_easy_escape(NULL, (char *)a, -1);
@@ -86,8 +82,7 @@ int test(char *URL)
printf("unescape -1 length: %s %d\n", ptr, outlen);
test_cleanup:
- if(ptr)
- curl_free(ptr);
+ curl_free(ptr);
curl_global_cleanup();
return (int)res;