Core/Misc: Fix static analysis issues

This commit is contained in:
jackpoz
2017-02-25 16:15:42 +01:00
parent 6940071994
commit bb6b1e794f
2 changed files with 27 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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;
}