From 15061d7e91d45bdfb42a9f39166dd30c5e47bcc4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 23 Apr 2014 17:21:18 +0200 Subject: fix memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'c') diff --git a/c/sha3.c b/c/sha3.c index 5bbfb1c..c460b5f 100644 --- a/c/sha3.c +++ b/c/sha3.c @@ -697,7 +697,7 @@ extern byte* sha3_digest(byte* restrict_ msg, long msglen, boolean withReturn) #endif free(M); M = null; - rc = (byte*)malloc(((n + 7) >> 3) * sizeof(byte)); + rc = withReturn ? (byte*)malloc(((n + 7) >> 3) * sizeof(byte)) : null; _msg = message; nnn = len; -- cgit v1.2.3-70-g09d2