RSRV: fix large buffer resize

Take into account that realloc may already have moved
the data to a new buffer.
This commit is contained in:
Michael Ritzert
2019-10-15 19:31:26 -07:00
committed by Michael Davidsaver
parent d814d67a35
commit 6903562915

View File

@@ -1343,10 +1343,13 @@ void casExpandBuffer ( struct message_buffer *buf, ca_uint32_t size, int sendbuf
// round up to multiple of 4K
size = ((size-1)|0xfff)+1;
if (buf->type==mbtLargeTCP)
if (buf->type==mbtLargeTCP) {
newbuf = realloc (buf->buf, size);
else
if(newbuf)
buf->buf = newbuf;
} else {
newbuf = malloc (size);
}
newtype = mbtLargeTCP;
newsize = size;