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/content_encoding.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/content_encoding.c')
-rw-r--r-- | lib/content_encoding.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/content_encoding.c b/lib/content_encoding.c index fa36aca4c..5a5824db4 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,8 +28,8 @@ #include <curl/curl.h> #include "sendf.h" #include "content_encoding.h" +#include "strdup.h" #include "curl_memory.h" - #include "memdebug.h" /* Comment this out if zlib is always going to be at least ver. 1.2.0.4 @@ -371,12 +371,9 @@ Curl_unencode_gzip_write(struct connectdata *conn, { /* Need more gzip header data state */ ssize_t hlen; - unsigned char *oldblock = z->next_in; - z->avail_in += (uInt)nread; - z->next_in = realloc(z->next_in, z->avail_in); + z->next_in = Curl_saferealloc(z->next_in, z->avail_in); if(z->next_in == NULL) { - free(oldblock); return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY); } /* Append the new block of data to the previous one */ |