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/curl_ntlm_wb.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/curl_ntlm_wb.c')
-rw-r--r-- | lib/curl_ntlm_wb.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c index afdea16c0..1d1b3a3f2 100644 --- a/lib/curl_ntlm_wb.c +++ b/lib/curl_ntlm_wb.c @@ -51,6 +51,7 @@ #include "curl_ntlm_wb.h" #include "url.h" #include "strerror.h" +#include "strdup.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" #include "curl_memory.h" @@ -293,11 +294,10 @@ static CURLcode ntlm_wb_response(struct connectdata *conn, buf[len_out - 1] = '\0'; break; } - newbuf = realloc(buf, len_out + NTLM_BUFSIZE); - if(!newbuf) { - free(buf); + newbuf = Curl_saferealloc(buf, len_out + NTLM_BUFSIZE); + if(!newbuf) return CURLE_OUT_OF_MEMORY; - } + buf = newbuf; } |