From a6f438f935eb043a915c19fde85e2680a0cd0cd2 Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Tue, 14 Aug 2018 18:44:26 -0400 Subject: [PATCH] igzip: Make igzip_rand_test exit when an error happens Change-Id: I35249618dad9668b361a87ee827820e977148a7c Signed-off-by: Roy Oursler --- igzip/igzip_rand_test.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/igzip/igzip_rand_test.c b/igzip/igzip_rand_test.c index b27adad..921d8c1 100644 --- a/igzip/igzip_rand_test.c +++ b/igzip/igzip_rand_test.c @@ -2146,6 +2146,8 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type) } fin_ret |= ret; + if (ret) + goto test_compress_cleanup; z_compressed_size = z_size; z_size = z_size_max; @@ -2194,6 +2196,8 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type) } fin_ret |= ret; + if (ret) + goto test_compress_cleanup; ret = 0; @@ -2238,6 +2242,8 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type) } fin_ret |= ret; + if (ret) + goto test_compress_cleanup; if (flush_type == NO_FLUSH) { create_rand_repeat_data(z_buf, z_size); @@ -2277,6 +2283,7 @@ int test_compress(uint8_t * in_buf, uint32_t in_size, uint32_t flush_type) fin_ret |= ret; } + test_compress_cleanup: free(z_buf); return fin_ret; @@ -2523,12 +2530,18 @@ int test_compress_file(char *file_name) } ret |= test_compress_stateless(in_buf, in_size, NO_FLUSH); - ret |= test_compress_stateless(in_buf, in_size, SYNC_FLUSH); - ret |= test_compress_stateless(in_buf, in_size, FULL_FLUSH); - ret |= test_compress(in_buf, in_size, NO_FLUSH); - ret |= test_compress(in_buf, in_size, SYNC_FLUSH); - ret |= test_compress(in_buf, in_size, FULL_FLUSH); - ret |= test_flush(in_buf, in_size); + if (!ret) + ret |= test_compress_stateless(in_buf, in_size, SYNC_FLUSH); + if (!ret) + ret |= test_compress_stateless(in_buf, in_size, FULL_FLUSH); + if (!ret) + ret |= test_compress(in_buf, in_size, NO_FLUSH); + if (!ret) + ret |= test_compress(in_buf, in_size, SYNC_FLUSH); + if (!ret) + ret |= test_compress(in_buf, in_size, FULL_FLUSH); + if (!ret) + ret |= test_flush(in_buf, in_size); if (ret) printf("Failed on file %s\n", file_name);