From d064ec35868720e0f29c1fe53a6e688333e71736 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 17 Nov 2008 20:43:00 +0000 Subject: Remove malloc return checks. Since they're in loops, they don't prevent memory from being leaked after the first iteration. Plus, when does malloc fail? git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@78 0d43b9a7-5ab2-4d7b-af9d-f64450cef757 --- huffman.c | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'huffman.c') diff --git a/huffman.c b/huffman.c index cc0c553..a1141a8 100644 --- a/huffman.c +++ b/huffman.c @@ -64,7 +64,6 @@ static int GetCompBit(uint8_t *comparray, uint32_t bitoffset); double DoHuffman(void) { - const char* context = "CPU:Huffman"; char* comparray = NULL; char* decomparray = NULL; char* plaintext = NULL; @@ -85,34 +84,12 @@ DoHuffman(void) ** estimate...but, who cares?) */ plaintext = malloc(ARRAY_SIZE * sizeof(char)); - if (!plaintext) { - fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context); - exit(1); - } comparray = malloc(ARRAY_SIZE * sizeof(char)); - if (!comparray) { - fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context); - free(plaintext); - exit(1); /* FIXME: do I need exits here? */ - } decomparray = malloc(ARRAY_SIZE * sizeof(char)); - if (!decomparray) { - fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context); - free(plaintext); - free(comparray); - exit(1); - } hufftree = malloc(sizeof(huff_node) * 512); - if (!hufftree) { - fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context); - free(plaintext); - free(comparray); - free(decomparray); - exit(1); - } /* ** Build the plaintext buffer. Since we want this to -- cgit v1.2.3