From 3cadc63e396a9b6a247b9e86b9a14e1642c9a85e Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 28 May 2018 14:39:26 +1000 Subject: [PATCH] Minor memleak clean ups on failures. --- stream.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stream.c b/stream.c index 3d78481..cec8ac6 100644 --- a/stream.c +++ b/stream.c @@ -1653,12 +1653,14 @@ fill_another: fatal_return(("Unable to malloc buffer of size %lld in fill_buffer\n", u_len), -1); sinfo->ram_alloced += u_len; - if (unlikely(read_buf(control, sinfo->fd, s_buf, padded_len))) + if (unlikely(read_buf(control, sinfo->fd, s_buf, padded_len))) { + dealloc(s_buf); return -1; + } - if (ENCRYPT) { - if (unlikely(!lrz_decrypt(control, s_buf, padded_len, blocksalt))) - return -1; + if (unlikely(ENCRYPT && !lrz_decrypt(control, s_buf, padded_len, blocksalt))) { + dealloc(s_buf); + return -1; } ucthread[s->uthread_no].s_buf = s_buf;