summaryrefslogtreecommitdiff
path: root/src/tls/tls_drv.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tls/tls_drv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tls/tls_drv.c b/src/tls/tls_drv.c
index dabe1491..e680cde6 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)