mirror of
https://github.com/curl/curl.git
synced 2026-08-26 12:23:34 +03:00
parent
9fffe925d2
commit
c4ea71ae32
2 changed files with 24 additions and 5 deletions
13
lib/dynbuf.c
13
lib/dynbuf.c
|
|
@ -21,12 +21,11 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "curl_setup.h"
|
||||
#include "strdup.h"
|
||||
#include "dynbuf.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
#include "curl_printf.h"
|
||||
#ifdef BUILDING_LIBCURL
|
||||
#include "curl_memory.h"
|
||||
#endif
|
||||
#include "memdebug.h"
|
||||
|
||||
#define MIN_FIRST_ALLOC 32
|
||||
|
|
@ -94,11 +93,15 @@ static CURLcode dyn_nappend(struct dynbuf *s,
|
|||
}
|
||||
|
||||
if(a != s->allc) {
|
||||
s->bufr = Curl_saferealloc(s->bufr, a);
|
||||
if(!s->bufr) {
|
||||
/* this logic is not using Curl_saferealloc() to make the tool not have to
|
||||
include that as well when it uses this code */
|
||||
void *p = realloc(s->bufr, a);
|
||||
if(!p) {
|
||||
Curl_safefree(s->bufr);
|
||||
s->leng = s->allc = 0;
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
s->bufr = p;
|
||||
s->allc = a;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue