From 39ce31de30ca07d7f739780abdd8b6652872dab9 Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Wed, 22 Jun 2016 14:34:49 -0700 Subject: [PATCH] igzip: Fix minor bug in igzip_rand_test Stop igzip_rand_test from trying to free a null pointer. Signed-off-by: Roy Oursler Reviewed-by: Greg Tucker --- igzip/igzip_rand_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/igzip/igzip_rand_test.c b/igzip/igzip_rand_test.c index f3d3ff4..4a9941b 100644 --- a/igzip/igzip_rand_test.c +++ b/igzip/igzip_rand_test.c @@ -1362,9 +1362,10 @@ int create_custom_hufftables(struct isal_hufftables *hufftables_custom, int argc fread(stream, 1, file_length, file); if (ferror(file)) { - printf("Error occurred when reading file"); + printf("Error occurred when reading file\n"); fclose(file); free(stream); + stream = NULL; return 1; } @@ -1373,7 +1374,10 @@ int create_custom_hufftables(struct isal_hufftables *hufftables_custom, int argc isal_update_histogram(stream, file_length, &histogram); fclose(file); - free(stream); + if (stream != NULL) { + free(stream); + stream = NULL; + } argc--; }