summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/tzx_cas.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2011-11-25 13:39:59 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2011-11-25 13:39:59 +0000
commitb1c3a23ed47c2900915f32020566dbcbb12e59e3 (patch)
treef8525a7af9f5656f25e35495c08d9d794ef69ed8 /src/lib/formats/tzx_cas.c
parentcb3d823e86ba95ebd45d7081f88b6a3cc2c7ad85 (diff)
Sync with MESS (no whatsnew)
Diffstat (limited to 'src/lib/formats/tzx_cas.c')
-rw-r--r--src/lib/formats/tzx_cas.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/formats/tzx_cas.c b/src/lib/formats/tzx_cas.c
index a3ac4f42b19..1ad91f771c2 100644
--- a/src/lib/formats/tzx_cas.c
+++ b/src/lib/formats/tzx_cas.c
@@ -81,7 +81,7 @@ static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen )
int pos = sizeof(TZX_HEADER) + 2;
int max_block_count = INITIAL_MAX_BLOCK_COUNT;
- blocks = (UINT8**)malloc(max_block_count);
+ blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*));
memset(blocks,0,max_block_count);
block_count = 0;
@@ -94,9 +94,8 @@ static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen )
{
void *old_blocks = blocks;
int old_max_block_count = max_block_count;
- printf("realoc");
max_block_count = max_block_count + BLOCK_COUNT_INCREMENTS;
- blocks = (UINT8**)malloc(max_block_count); // SHOULD NOT BE USING auto_alloc_array()
+ blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*)); // SHOULD NOT BE USING auto_alloc_array()
memset(blocks,0,max_block_count);
memcpy(blocks, old_blocks, old_max_block_count * sizeof(UINT8*));
if (blocks) free(old_blocks);