aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Gustafsson <daniel@yesql.se>2018-09-18 09:06:07 +0200
committerDaniel Gustafsson <daniel@yesql.se>2018-09-18 09:08:06 +0200
commited7830061e2e2d4ec3b0867157995805b066cf8d (patch)
treec03ff5acfc2da0f4f554e77aad6f6bb516a1cda1 /lib
parent23524bf85b887adbc513bc015c9530355967bc04 (diff)
darwinssl: Fix realloc memleak
The reallocation was using the input pointer for the return value, which leads to a memory leak on reallication failure. Fix by instead use the safe internal API call Curl_saferealloc(). Closes #3005 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Nick Zitzmann <nickzman@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/vtls/darwinssl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/vtls/darwinssl.c b/lib/vtls/darwinssl.c
index ae8a5cc1e..3eee53a02 100644
--- a/lib/vtls/darwinssl.c
+++ b/lib/vtls/darwinssl.c
@@ -120,6 +120,7 @@
#include "vtls.h"
#include "darwinssl.h"
#include "curl_printf.h"
+#include "strdup.h"
#include "curl_memory.h"
/* The last #include file should be: */
@@ -2056,7 +2057,7 @@ static int read_cert(const char *file, unsigned char **out, size_t *outlen)
if(len + n >= cap) {
cap *= 2;
- data = realloc(data, cap);
+ data = Curl_saferealloc(data, cap);
if(!data) {
close(fd);
return -1;