[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 136/151: lib1591: free memory properly on OOM, in the trailers c
From: |
gnunet |
Subject: |
[gnurl] 136/151: lib1591: free memory properly on OOM, in the trailers callback |
Date: |
Fri, 20 Dec 2019 14:27:25 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 38797e8811a9249d0ce988d664c89802b6235f2d
Author: Daniel Stenberg <address@hidden>
AuthorDate: Sun Dec 15 12:33:24 2019 +0100
lib1591: free memory properly on OOM, in the trailers callback
Detected by torture tests.
Closes #4720
---
tests/libtest/lib1591.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tests/libtest/lib1591.c b/tests/libtest/lib1591.c
index f0c6b4cb7..cc1c5b228 100644
--- a/tests/libtest/lib1591.c
+++ b/tests/libtest/lib1591.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <address@hidden>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -50,12 +50,25 @@ static size_t read_callback(void *ptr, size_t size, size_t
nmemb, void *stream)
return amount;
}
+/*
+ * carefully not leak memory on OOM
+ */
static int trailers_callback(struct curl_slist **list, void *userdata)
{
+ struct curl_slist *nlist = NULL;
+ struct curl_slist *nlist2 = NULL;
(void)userdata;
- *list = curl_slist_append(*list, "my-super-awesome-trailer: trail1");
- *list = curl_slist_append(*list, "my-other-awesome-trailer: trail2");
- return CURL_TRAILERFUNC_OK;
+ nlist = curl_slist_append(*list, "my-super-awesome-trailer: trail1");
+ if(nlist)
+ nlist2 = curl_slist_append(nlist, "my-other-awesome-trailer: trail2");
+ if(nlist2) {
+ *list = nlist2;
+ return CURL_TRAILERFUNC_OK;
+ }
+ else {
+ curl_slist_free_all(nlist);
+ return CURL_TRAILERFUNC_ABORT;
+ }
}
int test(char *URL)
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 112/151: conncache: CONNECT_ONLY connections assumed always in-use, (continued)
- [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
- [gnurl] 120/151: lib1557: fix mem-leak in OOM, gnunet, 2019/12/20
- [gnurl] 121/151: lib1559: fix mem-leak in OOM, gnunet, 2019/12/20
- [gnurl] 126/151: ntlm_wb: fix double-free in OOM, gnunet, 2019/12/20
- [gnurl] 124/151: unit1620: fix bad free in OOM, gnunet, 2019/12/20
- [gnurl] 128/151: azure: add a torture test, gnunet, 2019/12/20
- [gnurl] 130/151: hostip: suppress compiler warning, gnunet, 2019/12/20
- [gnurl] 136/151: lib1591: free memory properly on OOM, in the trailers callback,
gnunet <=
- [gnurl] 138/151: winbuild: Document CURL_STATICLIB requirement for static libcurl, gnunet, 2019/12/20
- [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