[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 123/151: unit1609: fix mem-leak in OOM
From: |
gnunet |
Subject: |
[gnurl] 123/151: unit1609: fix mem-leak in OOM |
Date: |
Fri, 20 Dec 2019 14:27:12 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 5ada9004583f9839448c697acf386ebbcbeb4bce
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Dec 12 23:43:29 2019 +0100
unit1609: fix mem-leak in OOM
Closes #4709
---
tests/unit/unit1609.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c
index 8223a147c..ce3ddf9d8 100644
--- a/tests/unit/unit1609.c
+++ b/tests/unit/unit1609.c
@@ -100,6 +100,9 @@ UNITTEST_START
{
int i;
int testnum = sizeof(tests) / sizeof(struct testcase);
+ struct Curl_multi *multi = NULL;
+ struct Curl_easy *easy = NULL;
+ struct curl_slist *list = NULL;
/* important: we setup cache outside of the loop
and also clean cache after the loop. In contrast,for example,
@@ -110,11 +113,9 @@ UNITTEST_START
int addressnum = sizeof (tests[i].address) / sizeof (*tests[i].address);
struct Curl_addrinfo *addr;
struct Curl_dns_entry *dns;
- struct curl_slist *list;
void *entry_id;
bool problem = false;
- struct Curl_multi *multi;
- struct Curl_easy *easy = curl_easy_init();
+ easy = curl_easy_init();
if(!easy) {
curl_global_cleanup();
return CURLE_OUT_OF_MEMORY;
@@ -122,21 +123,23 @@ UNITTEST_START
/* create a multi handle and add the easy handle to it so that the
hostcache is setup */
multi = curl_multi_init();
+ if(!multi)
+ goto error;
curl_multi_add_handle(multi, easy);
list = curl_slist_append(NULL, tests[i].optval);
if(!list)
- goto unit_test_abort;
+ goto error;
curl_easy_setopt(easy, CURLOPT_RESOLVE, list);
- Curl_loadhostpairs(easy);
+ if(Curl_loadhostpairs(easy))
+ goto error;
entry_id = (void *)aprintf("%s:%d", tests[i].host, tests[i].port);
- if(!entry_id) {
- curl_slist_free_all(list);
- goto unit_test_abort;
- }
+ if(!entry_id)
+ goto error;
+
dns = Curl_hash_pick(easy->dns.hostcache, entry_id, strlen(entry_id) + 1);
free(entry_id);
entry_id = NULL;
@@ -194,14 +197,22 @@ UNITTEST_START
}
curl_easy_cleanup(easy);
+ easy = NULL;
Curl_hash_destroy(&multi->hostcache);
curl_multi_cleanup(multi);
+ multi = NULL;
curl_slist_free_all(list);
+ list = NULL;
if(problem) {
unitfail++;
continue;
}
}
+ goto unit_test_abort;
+ error:
+ curl_easy_cleanup(easy);
+ curl_multi_cleanup(multi);
+ curl_slist_free_all(list);
}
UNITTEST_STOP
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 90/151: test342: make it return a 304 as the tag matches, (continued)
- [gnurl] 90/151: test342: make it return a 304 as the tag matches, gnunet, 2019/12/20
- [gnurl] 99/151: azure: add a vanilla macos build, gnunet, 2019/12/20
- [gnurl] 105/151: tests: fix permissions of ssh keys in WSL, gnunet, 2019/12/20
- [gnurl] 102/151: conn: always set bits.close with connclose(), gnunet, 2019/12/20
- [gnurl] 116/151: curl: improved cleanup in upload error path, gnunet, 2019/12/20
- [gnurl] 108/151: azure: add libssh2 and cmake macos builds, gnunet, 2019/12/20
- [gnurl] 107/151: curl: use errorf() better, gnunet, 2019/12/20
- [gnurl] 114/151: travis: make torture use --shallow=40, gnunet, 2019/12/20
- [gnurl] 119/151: altsvc: make the save function ignore NULL filenames, gnunet, 2019/12/20
- [gnurl] 118/151: curl: fix memory leak in OOM in etags logic, gnunet, 2019/12/20
- [gnurl] 123/151: unit1609: fix mem-leak in OOM,
gnunet <=
- [gnurl] 125/151: cirrus: Drop the FreeBSD 10.4 build, gnunet, 2019/12/20
- [gnurl] 96/151: docs: fix some typos, gnunet, 2019/12/20
- [gnurl] 94/151: lib: fix some loose ends for recently added CURLSSLOPT_NO_PARTIALCHAIN, gnunet, 2019/12/20
- [gnurl] 89/151: CMake: add support for building with the NSS vtls backend, gnunet, 2019/12/20
- [gnurl] 101/151: cirrus: enable clang sanitizers on freebsd 13, gnunet, 2019/12/20
- [gnurl] 110/151: RELEASE-NOTES: synced, gnunet, 2019/12/20
- [gnurl] 112/151: conncache: CONNECT_ONLY connections assumed always in-use, gnunet, 2019/12/20
- [gnurl] 115/151: mailmap: fix Andrew Ishchuk, gnunet, 2019/12/20
- [gnurl] 113/151: runtests: introduce --shallow to reduce huge torture tests, gnunet, 2019/12/20
- [gnurl] 117/151: doh: make it behave when built without proxy support, gnunet, 2019/12/20