From bb05af0d92212e29b1e4d566c670129c21192dc1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 15 Apr 2018 18:39:42 +0200 Subject: [PATCH] (libchdr) Prevent memory leak --- libretro-common/formats/libchdr/huffman.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libretro-common/formats/libchdr/huffman.c b/libretro-common/formats/libchdr/huffman.c index 04b0300dd0..dd041a76c9 100644 --- a/libretro-common/formats/libchdr/huffman.c +++ b/libretro-common/formats/libchdr/huffman.c @@ -294,7 +294,10 @@ enum huffman_error huffman_import_tree_huffman(struct huffman_decoder* decoder, /* make sure we ended up with the right number */ if (curcode != decoder->numcodes) + { + delete_huffman_decoder(smallhuff); return HUFFERR_INVALID_DATA; + } /* assign canonical codes for all nodes based on their code lengths */ error = huffman_assign_canonical_codes(decoder);