aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dep/libmpq/libmpq-hotfix2.diff22
-rw-r--r--dep/libmpq/libmpq/extract.c7
2 files changed, 27 insertions, 2 deletions
diff --git a/dep/libmpq/libmpq-hotfix2.diff b/dep/libmpq/libmpq-hotfix2.diff
new file mode 100644
index 00000000000..ecee18ec780
--- /dev/null
+++ b/dep/libmpq/libmpq-hotfix2.diff
@@ -0,0 +1,22 @@
+ dep/libmpq/libmpq/extract.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/dep/libmpq/libmpq/extract.c b/dep/libmpq/libmpq/extract.c
+index dc970b7..f9f14d6 100644
+--- a/dep/libmpq/libmpq/extract.c
++++ b/dep/libmpq/libmpq/extract.c
+@@ -57,9 +57,12 @@ int32_t libmpq__decompress_huffman(uint8_t *in_buf, uint32_t in_size, uint8_t *o
+ struct huffman_input_stream_s *is;
+
+ /* allocate memory for the huffman tree. */
+- if ((ht = malloc(sizeof(struct huffman_tree_s))) == NULL ||
+- (is = malloc(sizeof(struct huffman_input_stream_s))) == NULL) {
++ if ((ht = malloc(sizeof(struct huffman_tree_s))) == NULL) {
++ /* memory allocation problem. */
++ return LIBMPQ_ERROR_MALLOC;
++ }
+
++ if ((is = malloc(sizeof(struct huffman_input_stream_s))) == NULL) {
+ /* memory allocation problem. */
+ return LIBMPQ_ERROR_MALLOC;
+ }
diff --git a/dep/libmpq/libmpq/extract.c b/dep/libmpq/libmpq/extract.c
index dc970b75ce2..f9f14d6e390 100644
--- a/dep/libmpq/libmpq/extract.c
+++ b/dep/libmpq/libmpq/extract.c
@@ -57,9 +57,12 @@ int32_t libmpq__decompress_huffman(uint8_t *in_buf, uint32_t in_size, uint8_t *o
struct huffman_input_stream_s *is;
/* allocate memory for the huffman tree. */
- if ((ht = malloc(sizeof(struct huffman_tree_s))) == NULL ||
- (is = malloc(sizeof(struct huffman_input_stream_s))) == NULL) {
+ if ((ht = malloc(sizeof(struct huffman_tree_s))) == NULL) {
+ /* memory allocation problem. */
+ return LIBMPQ_ERROR_MALLOC;
+ }
+ if ((is = malloc(sizeof(struct huffman_input_stream_s))) == NULL) {
/* memory allocation problem. */
return LIBMPQ_ERROR_MALLOC;
}