diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-11-07 10:55:25 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-11-11 10:03:48 +0100 |
commit | 0649433da53c7165f839e24e889e131e2894dd32 (patch) | |
tree | 7e516c1702fe87c09f190e5dc47ecd3a9bede1b8 /lib/http.c | |
parent | cdfda3ee827da069f1871722278fd82e7cbb4194 (diff) | |
download | curl-0649433da53c7165f839e24e889e131e2894dd32.tar.gz |
realloc: use Curl_saferealloc to avoid common mistakes
Discussed: https://curl.haxx.se/mail/lib-2016-11/0087.html
Diffstat (limited to 'lib/http.c')
-rw-r--r-- | lib/http.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c index e7788e767..999d6da87 100644 --- a/lib/http.c +++ b/lib/http.c @@ -76,6 +76,7 @@ #include "pipeline.h" #include "http2.h" #include "connect.h" +#include "strdup.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" @@ -1255,14 +1256,13 @@ CURLcode Curl_add_buffer(Curl_send_buffer *in, const void *inptr, size_t size) if(in->buffer) /* we have a buffer, enlarge the existing one */ - new_rb = realloc(in->buffer, new_size); + new_rb = Curl_saferealloc(in->buffer, new_size); else /* create a new buffer */ new_rb = malloc(new_size); if(!new_rb) { /* If we failed, we cleanup the whole buffer and return error */ - Curl_safefree(in->buffer); free(in); return CURLE_OUT_OF_MEMORY; } |