aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib543.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2017-08-19 21:27:38 +0200
committerDan Fandrich <dan@coneharvesters.com>2017-08-19 21:42:47 +0200
commitc468c27b5a8abb8134b3f89439aaac45f37d22d7 (patch)
tree94fa73f73c03b1ff79df9264332724ecaec8e82c /tests/libtest/lib543.c
parentc1a75407cc515f310b8b7caf6bbf6e6cb5fde38c (diff)
tests: Make sure libtests call curl_global_cleanup()
This ensures that global data allocations are freed so Valgrind stays happy. This was a problem with at least PolarSSL and mbedTLS.
Diffstat (limited to 'tests/libtest/lib543.c')
-rw-r--r--tests/libtest/lib543.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c
index 6d2532d12..957839f7a 100644
--- a/tests/libtest/lib543.c
+++ b/tests/libtest/lib543.c
@@ -27,15 +27,18 @@
int test(char *URL)
{
- unsigned char a[] = {0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
- 0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa,
- 0x1d, 0x57, 0xe1};
+ static const unsigned char a[] = {
+ 0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
+ 0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa,
+ 0x1d, 0x57, 0xe1};
CURL *easy;
int asize;
char *s;
+ CURLcode res = CURLE_OK;
(void)URL;
+ global_init(CURL_GLOBAL_ALL);
easy = curl_easy_init();
if(!easy) {
fprintf(stderr, "curl_easy_init() failed\n");
@@ -44,7 +47,7 @@ int test(char *URL)
asize = (int)sizeof(a);
- s = curl_easy_escape(easy, (char *)a, asize);
+ s = curl_easy_escape(easy, (const char *)a, asize);
if(s)
printf("%s\n", s);
@@ -53,6 +56,7 @@ int test(char *URL)
curl_free(s);
curl_easy_cleanup(easy);
+ curl_global_cleanup();
return 0;
}