From 0649433da53c7165f839e24e889e131e2894dd32 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 7 Nov 2016 10:55:25 +0100 Subject: realloc: use Curl_saferealloc to avoid common mistakes Discussed: https://curl.haxx.se/mail/lib-2016-11/0087.html --- lib/rtsp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/rtsp.c') diff --git a/lib/rtsp.c b/lib/rtsp.c index d1bad19da..5da33d42c 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -36,6 +36,7 @@ #include "strcase.h" #include "select.h" #include "connect.h" +#include "strdup.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" #include "curl_memory.h" @@ -614,9 +615,9 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data, if(rtspc->rtp_buf) { /* There was some leftover data the last time. Merge buffers */ - char *newptr = realloc(rtspc->rtp_buf, rtspc->rtp_bufsize + *nread); + char *newptr = Curl_saferealloc(rtspc->rtp_buf, + rtspc->rtp_bufsize + *nread); if(!newptr) { - Curl_safefree(rtspc->rtp_buf); rtspc->rtp_buf = NULL; rtspc->rtp_bufsize = 0; return CURLE_OUT_OF_MEMORY; -- cgit v1.2.3