summaryrefslogtreecommitdiff
path: root/huffman.c
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-17 20:43:00 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-17 20:43:00 +0000
commitd064ec35868720e0f29c1fe53a6e688333e71736 (patch)
tree3662aad3e5a9b536de44a3d85a8720ea06812ba9 /huffman.c
parent10a5d62de08035803b5fadc5fcd32c873f8b1702 (diff)
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
Diffstat (limited to 'huffman.c')
-rw-r--r--huffman.c23
1 files changed, 0 insertions, 23 deletions
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