[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 70/208: test1537: fixed memory leak on OOM
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 70/208: test1537: fixed memory leak on OOM |
Date: |
Wed, 09 Aug 2017 17:34:27 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.55.0
in repository gnurl.
commit bec809cb2ee0136a911c1229d9a6f03c4904ed86
Author: Dan Fandrich <address@hidden>
AuthorDate: Sun Jun 25 22:59:55 2017 +0200
test1537: fixed memory leak on OOM
---
tests/libtest/lib1537.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/libtest/lib1537.c b/tests/libtest/lib1537.c
index d449164e4..b07d64fc5 100644
--- a/tests/libtest/lib1537.c
+++ b/tests/libtest/lib1537.c
@@ -25,8 +25,8 @@
int test(char *URL)
{
- unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
+ const unsigned char a[] = {0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7};
CURLcode res = CURLE_OK;
char *ptr = NULL;
int asize;
@@ -49,6 +49,10 @@ int test(char *URL)
/* deprecated API */
ptr = curl_escape((char *)a, asize);
printf("%s\n", ptr);
+ if(!ptr) {
+ res = TEST_ERR_MAJOR_BAD;
+ goto test_cleanup;
+ }
raw = curl_easy_unescape(NULL, ptr, (int)strlen(ptr), &outlen);
printf("outlen == %d\n", outlen);
@@ -59,6 +63,10 @@ int test(char *URL)
/* deprecated API */
raw = curl_unescape(ptr, (int)strlen(ptr));
+ if(!raw) {
+ res = TEST_ERR_MAJOR_BAD;
+ goto test_cleanup;
+ }
outlen = (int)strlen(raw);
printf("[old] outlen == %d\n", outlen);
printf("[old] unescape == original? %s\n",
@@ -77,6 +85,9 @@ int test(char *URL)
ptr = curl_easy_unescape(NULL, (char *)"moahahaha", -1, &outlen);
printf("unescape -1 length: %s %d\n", ptr, outlen);
+test_cleanup:
+ if(ptr)
+ curl_free(ptr);
curl_global_cleanup();
return (int)res;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 38/208: TODO: update the TOC too, (continued)
- [GNUnet-SVN] [gnurl] 38/208: TODO: update the TOC too, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 24/208: test1148: verify the -# progressbar, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 30/208: curl-compilers.m4: enable vla warning for clang, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 33/208: curl-compilers.m4: enable comma clang warning, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 34/208: Makefile.m32: enable -W for MinGW32 build, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 40/208: http_proxy: fix build with http and proxy, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 51/208: travis: do the distcheck test build out-of-tree as well, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 43/208: PIPELINING_SERVER_BL: cleanup the internal list use, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 37/208: TODO: implement support for CURLOPT_PREQUOTE with SFTP, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 73/208: socks: use proxy_user instead of proxy_name, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 70/208: test1537: fixed memory leak on OOM,
gnunet <=
- [GNUnet-SVN] [gnurl] 22/208: url: refactor the check for Windows drive letter in path, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 54/208: ci: whitelist branches to avoid testing feature branches twice, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 49/208: test1521: test getinfo's OFF_T types too, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 29/208: http-proxy: fix chunked-encoded CONNECT responses, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 74/208: socks: deduplicate the code for auth request, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 69/208: test1521: fix compiler warnings, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 44/208: getinfo: return sizes as curl_off_t, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 31/208: curl-compilers.m4: enable double-promotion warning, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 50/208: http: add --strip-path-slash and CURLOPT_STRIP_PATH_SLASH, gnunet, 2017/08/09
- [GNUnet-SVN] [gnurl] 35/208: curl: prevent binary output spewed to terminal, gnunet, 2017/08/09