From d4c04e42b8ed745881ff8cc74383b4c4c96b7f63 Mon Sep 17 00:00:00 2001 From: "a.out" Date: Thu, 29 Jan 2015 19:09:38 +0100 Subject: [PATCH 1/2] Fixed 2 memleaks in test code --- test/simple.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/simple.c b/test/simple.c index 09df38e..26a6394 100644 --- a/test/simple.c +++ b/test/simple.c @@ -102,7 +102,9 @@ simpleCompress(elzma_file_format format, const unsigned char * inData, *outData = ds.outData; *outLen = ds.outLen; } - + + elzma_compress_free(&hand); + return rc; } @@ -137,5 +139,7 @@ simpleDecompress(elzma_file_format format, const unsigned char * inData, *outLen = ds.outLen; } + elzma_decompress_free(&hand); + return rc; } From 2a4c31faf6fefab4917f00dc405b134fde4c46ad Mon Sep 17 00:00:00 2001 From: sbredahl Date: Fri, 30 Jan 2015 13:32:15 +0100 Subject: [PATCH 2/2] More memleak fixes --- src/compress.c | 2 ++ test/easylzma_test.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/compress.c b/src/compress.c index 78be112..947c0a9 100644 --- a/src/compress.c +++ b/src/compress.c @@ -66,6 +66,8 @@ elzma_compress_free(elzma_compress_handle * hand) (ISzAlloc *) &((*hand)->allocStruct), (ISzAlloc *) &((*hand)->allocStruct)); } + + free(*hand); } *hand = NULL; diff --git a/test/easylzma_test.c b/test/easylzma_test.c index 80691d9..22a3d22 100644 --- a/test/easylzma_test.c +++ b/test/easylzma_test.c @@ -161,6 +161,8 @@ static int roundTripTest(elzma_file_format format) free(decompressed); return 1; } + + free(decompressed); return ELZMA_E_OK; }