summaryrefslogtreecommitdiff
path: root/lib/http2.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-11-07 10:55:25 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-11-11 10:03:48 +0100
commit0649433da53c7165f839e24e889e131e2894dd32 (patch)
tree7e516c1702fe87c09f190e5dc47ecd3a9bede1b8 /lib/http2.c
parentcdfda3ee827da069f1871722278fd82e7cbb4194 (diff)
downloadgnurl-0649433da53c7165f839e24e889e131e2894dd32.tar.gz
gnurl-0649433da53c7165f839e24e889e131e2894dd32.tar.bz2
gnurl-0649433da53c7165f839e24e889e131e2894dd32.zip
realloc: use Curl_saferealloc to avoid common mistakes
Discussed: https://curl.haxx.se/mail/lib-2016-11/0087.html
Diffstat (limited to 'lib/http2.c')
-rw-r--r--lib/http2.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/http2.c b/lib/http2.c
index b0301da56..1484e1515 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -35,7 +35,7 @@
#include "url.h"
#include "connect.h"
#include "strtoofft.h"
-
+#include "strdup.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -841,10 +841,9 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
stream->push_headers_alloc) {
char **headp;
stream->push_headers_alloc *= 2;
- headp = realloc(stream->push_headers,
- stream->push_headers_alloc * sizeof(char *));
+ headp = Curl_saferealloc(stream->push_headers,
+ stream->push_headers_alloc * sizeof(char *));
if(!headp) {
- free(stream->push_headers);
stream->push_headers = NULL;
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
}