[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 229/264: http: free memory when Alt-Used header creation fails d
From: |
gnunet |
Subject: |
[gnurl] 229/264: http: free memory when Alt-Used header creation fails due to OOM |
Date: |
Thu, 30 Apr 2020 16:08:52 +0200 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit df28ed6116862921994b1abc5147cb64360e4241
Author: Daniel Stenberg <address@hidden>
AuthorDate: Mon Apr 20 09:02:47 2020 +0200
http: free memory when Alt-Used header creation fails due to OOM
Reported-by: James Fuller
Fixes #5268
Closes #5269
---
lib/http.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/lib/http.c b/lib/http.c
index 5a2edf09e..c3f7c350c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1333,7 +1333,6 @@ CURLcode Curl_add_bufferf(Curl_send_buffer **inp, const
char *fmt, ...)
{
char *s;
va_list ap;
- Curl_send_buffer *in = *inp;
va_start(ap, fmt);
s = vaprintf(fmt, ap); /* this allocs a new string to append */
va_end(ap);
@@ -1344,9 +1343,7 @@ CURLcode Curl_add_bufferf(Curl_send_buffer **inp, const
char *fmt, ...)
return result;
}
/* If we failed, we cleanup the whole buffer and return error */
- free(in->buffer);
- free(in);
- *inp = NULL;
+ Curl_add_buffer_free(inp);
return CURLE_OUT_OF_MEMORY;
}
@@ -1363,9 +1360,7 @@ CURLcode Curl_add_buffer(Curl_send_buffer **inp, const
void *inptr,
/* If resulting used size of send buffer would wrap size_t, cleanup
the whole buffer and return error. Otherwise the required buffer
size will fit into a single allocatable memory chunk */
- Curl_safefree(in->buffer);
- free(in);
- *inp = NULL;
+ Curl_add_buffer_free(inp);
return CURLE_OUT_OF_MEMORY;
}
@@ -2615,8 +2610,10 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
if(conn->bits.altused && !Curl_checkheaders(conn, "Alt-Used")) {
altused = aprintf("Alt-Used: %s:%d\r\n",
conn->conn_to_host.name, conn->conn_to_port);
- if(!altused)
+ if(!altused) {
+ Curl_add_buffer_free(&req_buffer);
return CURLE_OUT_OF_MEMORY;
+ }
}
#endif
result =
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 259/264: doh: Constify some input pointers, (continued)
- [gnurl] 259/264: doh: Constify some input pointers, gnunet, 2020/04/30
- [gnurl] 161/264: release-notes.pl: detect the start of the references in cleanup mode, gnunet, 2020/04/30
- [gnurl] 214/264: mime: properly check Content-Type even if it has parameters, gnunet, 2020/04/30
- [gnurl] 164/264: tests: add Windows compatible pidwait like pidkill and pidterm, gnunet, 2020/04/30
- [gnurl] 166/264: tests/server/util.c: use curl_off_t instead of long for pid, gnunet, 2020/04/30
- [gnurl] 167/264: compressed.d: stress that the headers are not modified, gnunet, 2020/04/30
- [gnurl] 165/264: tests: use Cygwin/msys PIDs for stunnel and sshd on Windows, gnunet, 2020/04/30
- [gnurl] 264/264: make gnurl-aux, gnunet, 2020/04/30
- [gnurl] 177/264: cirrus: no longer ignore test 504 which is working again, gnunet, 2020/04/30
- [gnurl] 180/264: tool: do not declare functions with Curl_ prefix, gnunet, 2020/04/30
- [gnurl] 229/264: http: free memory when Alt-Used header creation fails due to OOM,
gnunet <=
- [gnurl] 162/264: RELEASE-NOTES: synced, gnunet, 2020/04/30
- [gnurl] 157/264: sshserver.pl: use cached Win32 environment check variable, gnunet, 2020/04/30
- [gnurl] 175/264: test1908: avoid using fixed port number in test data, gnunet, 2020/04/30
- [gnurl] 183/264: tests: support hex encoded data and mqtt server, gnunet, 2020/04/30
- [gnurl] 156/264: appveyor: partially revert 3413a110 to keep build without proxy, gnunet, 2020/04/30
- [gnurl] 173/264: socks: Fix blocking timeout logic, gnunet, 2020/04/30
- [gnurl] 190/264: RELEASE-NOTES: synced, gnunet, 2020/04/30
- [gnurl] 188/264: github/workflow: enable MQTT in the macOS debug build, gnunet, 2020/04/30
- [gnurl] 186/264: travis: add mqtt job on Linux, gnunet, 2020/04/30
- [gnurl] 230/264: server/tftpd: fix compiler warning, gnunet, 2020/04/30