From 3e720fdd96acdc27cb6e3c2a7f353a00aaaa4784 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 14 Jan 2020 22:19:15 +0100 Subject: [PATCH] Added two more sanity checks into the FDI2RAW code. --- src/floppy/fdi2raw.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/floppy/fdi2raw.c b/src/floppy/fdi2raw.c index ffb3c3a53..5cbbd9a0c 100644 --- a/src/floppy/fdi2raw.c +++ b/src/floppy/fdi2raw.c @@ -187,10 +187,14 @@ static uae_u8 temp, temp2; static uae_u8 *expand_tree (uae_u8 *stream, NODE *node) { if (temp & temp2) { - fdi_free (node->left); - node->left = 0; - fdi_free (node->right); - node->right = 0; + if (node->left) { + fdi_free (node->left); + node->left = 0; + } + if (node->right) { + fdi_free (node->right); + node->right = 0; + } temp2 >>= 1; if (!temp2) { temp = *stream++;