[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 122/151: unit1607: fix mem-leak in OOM
From: |
gnunet |
Subject: |
[gnurl] 122/151: unit1607: fix mem-leak in OOM |
Date: |
Fri, 20 Dec 2019 14:27:11 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit f389953da0f9da754550f6f5540d44d7aaf2ea32
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Dec 12 23:30:42 2019 +0100
unit1607: fix mem-leak in OOM
Closes #4709
---
tests/unit/unit1607.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c
index a8b0331ce..e8d412080 100644
--- a/tests/unit/unit1607.c
+++ b/tests/unit/unit1607.c
@@ -99,23 +99,23 @@ static const struct testcase tests[] = {
};
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;
for(i = 0; i < testnum; ++i) {
int j;
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();
- if(!easy) {
- curl_global_cleanup();
- return CURLE_OUT_OF_MEMORY;
- }
+ easy = curl_easy_init();
+ if(!easy)
+ goto error;
/* create a multi handle and add the easy handle to it so that the
hostcache is setup */
@@ -124,16 +124,14 @@ UNITTEST_START
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);
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;
@@ -202,12 +200,20 @@ UNITTEST_START
}
curl_easy_cleanup(easy);
+ easy = NULL;
curl_multi_cleanup(multi);
+ multi = NULL;
curl_slist_free_all(list);
+ list = NULL;
if(problem) {
unitfail++;
continue;
}
}
+ 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] 142/151: KNOWN_BUGS: LDAP on Windows doesn't work, (continued)
- [gnurl] 142/151: KNOWN_BUGS: LDAP on Windows doesn't work, gnunet, 2019/12/20
- [gnurl] 132/151: multi: free sockhash on OOM, gnunet, 2019/12/20
- [gnurl] 135/151: runtests: --repeat=[num] to repeat tests, gnunet, 2019/12/20
- [gnurl] 133/151: azure: add a torture test on mac, gnunet, 2019/12/20
- [gnurl] 143/151: KNOWN_BUGS: Connection information when using TCP Fast Open, gnunet, 2019/12/20
- [gnurl] 127/151: azure: make the default build use --enable-debug --enable-werror, gnunet, 2019/12/20
- [gnurl] 131/151: tests: use DoH feature for DoH tests, gnunet, 2019/12/20
- [gnurl] 144/151: KNOWN_BUGS: TLS session cache doesn't work with TFO, gnunet, 2019/12/20
- [gnurl] 140/151: cirrus: Switch to the FreeBSD 12.1 point release & enable more tests., gnunet, 2019/12/20
- [gnurl] 145/151: Revert "checksrc: fix regexp for ASSIGNWITHINCONDITION", gnunet, 2019/12/20
- [gnurl] 122/151: unit1607: fix mem-leak in OOM,
gnunet <=
- [gnurl] 134/151: RELEASE-NOTES: synced, gnunet, 2019/12/20
- [gnurl] 139/151: azure: the macos cmake doesn't need to install cmake, gnunet, 2019/12/20
- [gnurl] 137/151: libssh2: add support for ECDSA and ed25519 knownhost keys, gnunet, 2019/12/20
- [gnurl] 129/151: tests: fix build with `CURL_DISABLE_DOH`, gnunet, 2019/12/20
- [gnurl] 151/151: make gnurl, gnunet, 2019/12/20
- [gnurl] 141/151: docs: TLS SRP doesn't work with TLS 1.3, gnunet, 2019/12/20
- [gnurl] 147/151: lib: remove ASSIGNWITHINCONDITION exceptions, use our code style, gnunet, 2019/12/20
- [gnurl] 146/151: tests: make sure checksrc runs on header files too, gnunet, 2019/12/20
- [gnurl] 150/151: makefile, gnunet, 2019/12/20
- [gnurl] 148/151: define: remove HAVE_ENGINE_LOAD_BUILTIN_ENGINES, not used anymore, gnunet, 2019/12/20