diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tls/tls_drv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tls/tls_drv.c b/src/tls/tls_drv.c index dabe14911..e680cde65 100644 --- a/src/tls/tls_drv.c +++ b/src/tls/tls_drv.c @@ -442,8 +442,10 @@ static ErlDrvSSizeT tls_drv_control(ErlDrvData handle, { //printf("%d bytes of decrypted data read from state machine\r\n",res); rlen += res; - size += BUF_SIZE; - b = driver_realloc_binary(b, size); + if (size - rlen < BUF_SIZE) { + size *= 2; + b = driver_realloc_binary(b, size); + } } if (res < 0) |