/** @file\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Compression routine. The compression algorithm is a mixture of LZ77 and Huffman \r
+coding. LZ77 transforms the source data into a sequence of Original Characters \r
+and Pointers to repeated strings. This sequence is further divided into Blocks \r
+and Huffman codings are applied to each Block.\r
+ \r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
\r
-Module Name:\r
-\r
- TianoCompress.c\r
-\r
-Abstract:\r
-\r
- Compression routine. The compression algorithm is a mixture of\r
- LZ77 and Huffman coding. LZ77 transforms the source data into a\r
- sequence of Original Characters and Pointers to repeated strings.\r
- This sequence is further divided into Blocks and Huffman codings\r
- are applied to each Block.\r
-\r
**/\r
\r
#include "Compress.h"\r
UINT32 Index;\r
\r
mText = malloc (WNDSIZ * 2 + MAXMATCH);\r
+ if (mText == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) {\r
mText[Index] = 0;\r
}\r
mParent = malloc (WNDSIZ * 2 * sizeof (*mParent));\r
mPrev = malloc (WNDSIZ * 2 * sizeof (*mPrev));\r
mNext = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext));\r
+ if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||\r
+ mParent == NULL || mPrev == NULL || mNext == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
\r
mBufSiz = BLKSIZ;\r
mBuf = malloc (mBufSiz);\r