summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/astrafr.c5
-rw-r--r--src/mess/drivers/binbug.c4
-rw-r--r--src/mess/drivers/cd2650.c4
-rw-r--r--src/mess/drivers/d6800.c4
-rw-r--r--src/mess/drivers/homelab.c17
-rw-r--r--src/mess/drivers/instruct.c4
-rw-r--r--src/mess/drivers/lynx.c6
-rw-r--r--src/mess/drivers/phunsy.c4
-rw-r--r--src/mess/drivers/pipbug.c4
-rw-r--r--src/mess/drivers/psx.c10
-rw-r--r--src/mess/drivers/ravens.c4
-rw-r--r--src/mess/drivers/timex.c14
-rw-r--r--src/mess/drivers/vc4000.c4
-rw-r--r--src/mess/machine/amstrad.c6
-rw-r--r--src/mess/machine/atarifdc.h2
-rw-r--r--src/mess/machine/cbm_snqk.c6
-rw-r--r--src/mess/machine/hp48.c4
-rw-r--r--src/mess/machine/lviv.c6
-rw-r--r--src/mess/machine/microtan.c9
-rw-r--r--src/mess/machine/nc.c6
-rw-r--r--src/mess/machine/primo.c14
-rw-r--r--src/mess/machine/spec_snqk.c12
-rw-r--r--src/mess/machine/ti85.c4
-rw-r--r--src/mess/machine/ti99/datamux.c4
-rw-r--r--src/mess/machine/ti99/gromport.c6
-rw-r--r--src/mess/machine/x68k_hdc.c4
26 files changed, 83 insertions, 84 deletions
diff --git a/src/mame/drivers/astrafr.c b/src/mame/drivers/astrafr.c
index 16044f5c919..f735cf17998 100644
--- a/src/mame/drivers/astrafr.c
+++ b/src/mame/drivers/astrafr.c
@@ -2090,11 +2090,10 @@ ROM_END
void astra_addresslines( UINT16* src, size_t srcsize, int small )
{
- UINT16 *dst = (UINT16*)malloc(srcsize);
+ UINT16 *dst = global_alloc_array(UINT16, srcsize/2);
int blocksize;
-
if (small) blocksize= 0x100000/2;
else blocksize= 0x100000;
@@ -2108,7 +2107,7 @@ void astra_addresslines( UINT16* src, size_t srcsize, int small )
}
memcpy(src,dst, srcsize);
- free(dst);
+ global_free_array(dst);
}
diff --git a/src/mess/drivers/binbug.c b/src/mess/drivers/binbug.c
index 3b6a1d14c0a..00878720841 100644
--- a/src/mess/drivers/binbug.c
+++ b/src/mess/drivers/binbug.c
@@ -246,7 +246,7 @@ QUICKLOAD_LOAD_MEMBER( binbug_state, binbug )
}
else
{
- quick_data = (UINT8*)malloc(quick_length);
+ quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -290,7 +290,7 @@ QUICKLOAD_LOAD_MEMBER( binbug_state, binbug )
}
}
- free( quick_data );
+ global_free_array(quick_data);
}
return result;
diff --git a/src/mess/drivers/cd2650.c b/src/mess/drivers/cd2650.c
index 78470251926..a55e301528a 100644
--- a/src/mess/drivers/cd2650.c
+++ b/src/mess/drivers/cd2650.c
@@ -217,7 +217,7 @@ QUICKLOAD_LOAD_MEMBER( cd2650_state, cd2650 )
}
else
{
- UINT8 *quick_data = (UINT8*)malloc(quick_length);
+ UINT8 *quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -271,7 +271,7 @@ QUICKLOAD_LOAD_MEMBER( cd2650_state, cd2650 )
}
}
- free( quick_data );
+ global_free_array(quick_data);
}
return result;
diff --git a/src/mess/drivers/d6800.c b/src/mess/drivers/d6800.c
index 815f888844b..f9da7fa98ec 100644
--- a/src/mess/drivers/d6800.c
+++ b/src/mess/drivers/d6800.c
@@ -351,7 +351,7 @@ QUICKLOAD_LOAD_MEMBER( d6800_state, d6800 )
int result = IMAGE_INIT_FAIL;
quick_length = image.length();
- quick_data = (UINT8*)malloc(quick_length);
+ quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -383,7 +383,7 @@ QUICKLOAD_LOAD_MEMBER( d6800_state, d6800 )
result = IMAGE_INIT_PASS;
}
- free( quick_data );
+ global_free_array(quick_data);
}
return result;
diff --git a/src/mess/drivers/homelab.c b/src/mess/drivers/homelab.c
index 35103c94255..7eaa8add922 100644
--- a/src/mess/drivers/homelab.c
+++ b/src/mess/drivers/homelab.c
@@ -657,12 +657,11 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab)
int read_;
quick_length = image.length();
- quick_data = (UINT8*)malloc(quick_length);
+ quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
image.message(" Cannot open file");
- free(quick_data);
return IMAGE_INIT_FAIL;
}
@@ -671,7 +670,7 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot read the file");
image.message(" Cannot read the file");
- free(quick_data);
+ global_free_array(quick_data);
return IMAGE_INIT_FAIL;
}
@@ -681,7 +680,7 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Invalid header");
image.message(" Invalid header");
- free(quick_data);
+ global_free_array(quick_data);
return IMAGE_INIT_FAIL;
}
@@ -691,7 +690,7 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File name too long");
image.message(" File name too long");
- free(quick_data);
+ global_free_array(quick_data);
return IMAGE_INIT_FAIL;
}
@@ -705,7 +704,7 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Unexpected EOF while getting file size");
image.message(" Unexpected EOF while getting file size");
- free(quick_data);
+ global_free_array(quick_data);
return IMAGE_INIT_FAIL;
}
@@ -717,7 +716,7 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "File too large");
image.message(" File too large");
- free(quick_data);
+ global_free_array(quick_data);
return IMAGE_INIT_FAIL;
}
@@ -733,13 +732,13 @@ QUICKLOAD_LOAD_MEMBER( homelab_state,homelab)
snprintf(message, ARRAY_LENGTH(message), "%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
image.seterror(IMAGE_ERROR_INVALIDIMAGE, message);
image.message("%s: Unexpected EOF while writing byte to %04X", pgmname, (unsigned) j);
- free(quick_data);
+ global_free_array(quick_data);
return IMAGE_INIT_FAIL;
}
space.write_byte(j, ch);
}
- free(quick_data);
+ global_free_array(quick_data);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/drivers/instruct.c b/src/mess/drivers/instruct.c
index 8a52f9034a0..c4102308d99 100644
--- a/src/mess/drivers/instruct.c
+++ b/src/mess/drivers/instruct.c
@@ -339,7 +339,7 @@ QUICKLOAD_LOAD_MEMBER( instruct_state, instruct )
}
else
{
- UINT8* quick_data = (UINT8*)malloc(quick_length);
+ UINT8* quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -405,7 +405,7 @@ QUICKLOAD_LOAD_MEMBER( instruct_state, instruct )
}
}
- free( quick_data );
+ global_free_array(quick_data);
}
return result;
diff --git a/src/mess/drivers/lynx.c b/src/mess/drivers/lynx.c
index a6bc642af40..458cc646bb4 100644
--- a/src/mess/drivers/lynx.c
+++ b/src/mess/drivers/lynx.c
@@ -167,18 +167,18 @@ QUICKLOAD_LOAD_MEMBER( lynx_state, lynx )
length = header[5] | (header[4]<<8);
length -= 10;
- data = (UINT8*)malloc(length);
+ data = global_alloc_array(UINT8, length);
if (image.fread( data, length) != length)
{
- free(data);
+ global_free_array(data);
return IMAGE_INIT_FAIL;
}
for (i = 0; i < length; i++)
space.write_byte(start + i, data[i]);
- free(data);
+ global_free_array(data);
rom[0x1fc] = start & 0xff;
rom[0x1fd] = start >> 8;
diff --git a/src/mess/drivers/phunsy.c b/src/mess/drivers/phunsy.c
index b2cbeebbc33..07fc51b4606 100644
--- a/src/mess/drivers/phunsy.c
+++ b/src/mess/drivers/phunsy.c
@@ -296,7 +296,7 @@ QUICKLOAD_LOAD_MEMBER( phunsy_state, phunsy )
}
else
{
- quick_data = (UINT8*)malloc(quick_length);
+ quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -324,7 +324,7 @@ QUICKLOAD_LOAD_MEMBER( phunsy_state, phunsy )
result = IMAGE_INIT_PASS;
}
- free( quick_data );
+ global_free_array(quick_data);
}
return result;
diff --git a/src/mess/drivers/pipbug.c b/src/mess/drivers/pipbug.c
index b1f749c4304..3d745808f89 100644
--- a/src/mess/drivers/pipbug.c
+++ b/src/mess/drivers/pipbug.c
@@ -113,7 +113,7 @@ QUICKLOAD_LOAD_MEMBER( pipbug_state, pipbug )
}
else
{
- quick_data = (UINT8*)malloc(quick_length);
+ quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -157,7 +157,7 @@ QUICKLOAD_LOAD_MEMBER( pipbug_state, pipbug )
}
}
- free( quick_data );
+ global_free_array(quick_data);
}
return result;
diff --git a/src/mess/drivers/psx.c b/src/mess/drivers/psx.c
index dc6bee720c9..81ad974a183 100644
--- a/src/mess/drivers/psx.c
+++ b/src/mess/drivers/psx.c
@@ -392,7 +392,7 @@ int psx1_state::load_psf( cpu_device *cpu, unsigned char *p_n_file, int n_len )
}
n_uncompressed = 0x200000;
- p_n_uncompressed = (unsigned char *)malloc( n_uncompressed );
+ p_n_uncompressed = global_alloc_array( unsigned char, n_uncompressed );
if( uncompress( p_n_uncompressed, &n_uncompressed, p_n_compressed, n_compressed ) != Z_OK )
{
@@ -407,7 +407,7 @@ int psx1_state::load_psf( cpu_device *cpu, unsigned char *p_n_file, int n_len )
n_return = 1;
}
- free( p_n_uncompressed );
+ global_free_array( p_n_uncompressed );
}
return n_return;
}
@@ -439,7 +439,7 @@ DIRECT_UPDATE_MEMBER(psx1_state::psx_setopbase)
}
m_exe_size = 0;
- free( m_exe_buffer );
+ global_free_array( m_exe_buffer );
}
return address;
}
@@ -449,7 +449,7 @@ QUICKLOAD_LOAD_MEMBER( psx1_state, psx_exe_load )
address_space &space = m_maincpu->space( AS_PROGRAM );
m_exe_size = 0;
- m_exe_buffer = (UINT8*)malloc( quickload_size );
+ m_exe_buffer = global_alloc_array( UINT8, quickload_size );
if( m_exe_buffer == NULL )
{
logerror( "psx_exe_load: out of memory\n" );
@@ -457,7 +457,7 @@ QUICKLOAD_LOAD_MEMBER( psx1_state, psx_exe_load )
}
if( image.fread( m_exe_buffer, quickload_size ) != quickload_size )
{
- free( m_exe_buffer );
+ global_free_array( m_exe_buffer );
return IMAGE_INIT_FAIL;
}
m_exe_size = quickload_size;
diff --git a/src/mess/drivers/ravens.c b/src/mess/drivers/ravens.c
index 542eb48966d..29ca1369d26 100644
--- a/src/mess/drivers/ravens.c
+++ b/src/mess/drivers/ravens.c
@@ -289,7 +289,7 @@ QUICKLOAD_LOAD_MEMBER( ravens_state, ravens )
}
else
{
- quick_data = (UINT8*)malloc(quick_length);
+ quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -333,7 +333,7 @@ QUICKLOAD_LOAD_MEMBER( ravens_state, ravens )
}
}
- free( quick_data );
+ global_free_array(quick_data);
}
return result;
diff --git a/src/mess/drivers/timex.c b/src/mess/drivers/timex.c
index 17f49ee2ee3..5dc8c4d2005 100644
--- a/src/mess/drivers/timex.c
+++ b/src/mess/drivers/timex.c
@@ -637,7 +637,7 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
return IMAGE_INIT_FAIL;
}
- file_data = (UINT8 *)malloc(file_size);
+ file_data = global_alloc_array(UINT8, file_size);
if (file_data == NULL)
{
logerror ("Memory allocating error\n");
@@ -651,7 +651,7 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
if (chunks_in_file*0x2000+0x09 != file_size)
{
- free (file_data);
+ global_free_array(file_data);
logerror ("File corrupted\n");
return IMAGE_INIT_FAIL;
}
@@ -660,10 +660,10 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
{
case 0x00: logerror ("DOCK cart\n");
timex_cart.type = TIMEX_CART_DOCK;
- timex_cart.data = (UINT8*) malloc (0x10000);
+ timex_cart.data = global_alloc_array(UINT8, 0x10000);
if (!timex_cart.data)
{
- free (file_data);
+ global_free_array(file_data);
logerror ("Memory allocate error\n");
return IMAGE_INIT_FAIL;
}
@@ -684,11 +684,11 @@ DEVICE_IMAGE_LOAD_MEMBER( spectrum_state, timex_cart )
memset (timex_cart.data+i*0x2000, 0xff, 0x2000);
}
}
- free (file_data);
+ global_free_array(file_data);
break;
default: logerror ("Cart type not supported\n");
- free (file_data);
+ global_free_array(file_data);
timex_cart.type = TIMEX_CART_NONE;
return IMAGE_INIT_FAIL;
}
@@ -703,7 +703,7 @@ DEVICE_IMAGE_UNLOAD_MEMBER( spectrum_state, timex_cart )
{
if (timex_cart.data)
{
- free (timex_cart.data);
+ global_free_array(timex_cart.data);
timex_cart.data = NULL;
}
timex_cart.type = TIMEX_CART_NONE;
diff --git a/src/mess/drivers/vc4000.c b/src/mess/drivers/vc4000.c
index 9e076ea2c60..51b82085ef2 100644
--- a/src/mess/drivers/vc4000.c
+++ b/src/mess/drivers/vc4000.c
@@ -563,7 +563,7 @@ QUICKLOAD_LOAD_MEMBER( vc4000_state,vc4000)
int result = IMAGE_INIT_FAIL;
quick_length = image.length();
- quick_data = (UINT8*)malloc(quick_length);
+ quick_data = global_alloc_array(UINT8, quick_length);
if (!quick_data)
{
image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Cannot open file");
@@ -678,7 +678,7 @@ QUICKLOAD_LOAD_MEMBER( vc4000_state,vc4000)
}
}
}
- free (quick_data);
+ global_free_array(quick_data);
}
return result;
}
diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c
index 48afac95ae1..030866d689e 100644
--- a/src/mess/machine/amstrad.c
+++ b/src/mess/machine/amstrad.c
@@ -3155,7 +3155,7 @@ SNAPSHOT_LOAD_MEMBER( amstrad_state,amstrad)
if (snapshot_size < 8)
return IMAGE_INIT_FAIL;
- snapshot = (UINT8 *)malloc(snapshot_size);
+ snapshot = global_alloc_array(UINT8, snapshot_size);
if (!snapshot)
return IMAGE_INIT_FAIL;
@@ -3164,12 +3164,12 @@ SNAPSHOT_LOAD_MEMBER( amstrad_state,amstrad)
if (memcmp(snapshot, "MV - SNA", 8))
{
- free(snapshot);
+ global_free_array(snapshot);
return IMAGE_INIT_FAIL;
}
amstrad_handle_snapshot(snapshot);
- free(snapshot);
+ global_free_array(snapshot);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/machine/atarifdc.h b/src/mess/machine/atarifdc.h
index 334c4bd8dbc..6eb132dabbc 100644
--- a/src/mess/machine/atarifdc.h
+++ b/src/mess/machine/atarifdc.h
@@ -32,7 +32,7 @@ private:
struct atari_drive
{
- UINT8 *image; /* malloc'd image */
+ UINT8 *image; /* alloc'd image */
int type; /* type of image (XFD, ATR, DSK) */
int mode; /* 0 read only, != 0 read/write */
int density; /* 0 SD, 1 MD, 2 DD */
diff --git a/src/mess/machine/cbm_snqk.c b/src/mess/machine/cbm_snqk.c
index 116d5b2f3d0..816911110cd 100644
--- a/src/mess/machine/cbm_snqk.c
+++ b/src/mess/machine/cbm_snqk.c
@@ -69,7 +69,7 @@ int general_cbm_loadsnap( device_image_interface &image, const char *file_type,
address = 2049;
snapshot_size -= 2;
- data = (UINT8*)malloc(snapshot_size);
+ data = global_alloc_array(UINT8, snapshot_size);
if (!data)
goto error;
@@ -81,12 +81,12 @@ int general_cbm_loadsnap( device_image_interface &image, const char *file_type,
space.write_byte(address + i + offset, data[i]);
cbm_sethiaddress(space, address + snapshot_size);
- free(data);
+ global_free_array(data);
return IMAGE_INIT_PASS;
error:
if (data)
- free(data);
+ global_free_array(data);
return IMAGE_INIT_FAIL;
}
diff --git a/src/mess/machine/hp48.c b/src/mess/machine/hp48.c
index e94bffe09a8..9c3c4774ec5 100644
--- a/src/mess/machine/hp48.c
+++ b/src/mess/machine/hp48.c
@@ -992,7 +992,7 @@ void hp48_port_image_device::hp48_fill_port()
struct hp48_port_interface* conf = (struct hp48_port_interface*) static_config();
int size = state->m_port_size[conf->port];
LOG(( "hp48_fill_port: %s module=%i size=%i rw=%i\n", tag(), conf->module, size, state->m_port_write[conf->port] ));
- state->m_port_data[conf->port] = (UINT8*)malloc( 2 * size );
+ state->m_port_data[conf->port] = global_alloc_array(UINT8, 2 * size);
memset( state->m_port_data[conf->port], 0, 2 * size );
state->m_modules[conf->module].off_mask = 2 * (( size > 128 * 1024 ) ? 128 * 1024 : size) - 1;
state->m_modules[conf->module].read = read8_delegate();
@@ -1072,7 +1072,7 @@ void hp48_port_image_device::call_unload()
fseek( 0, SEEK_SET );
fwrite( state->m_port_data[conf->port], state->m_port_size[conf->port] );
}
- free( state->m_port_data[conf->port] );
+ global_free_array( state->m_port_data[conf->port] );
hp48_unfill_port();
state->hp48_apply_modules();
}
diff --git a/src/mess/machine/lviv.c b/src/mess/machine/lviv.c
index 2e871a5c16b..2088f3f02cd 100644
--- a/src/mess/machine/lviv.c
+++ b/src/mess/machine/lviv.c
@@ -323,7 +323,7 @@ SNAPSHOT_LOAD_MEMBER( lviv_state, lviv )
{
UINT8 *lviv_snapshot_data;
- lviv_snapshot_data = (UINT8*)malloc(LVIV_SNAPSHOT_SIZE);
+ lviv_snapshot_data = global_alloc_array(UINT8, LVIV_SNAPSHOT_SIZE);
if (!lviv_snapshot_data)
{
logerror ("Unable to load snapshot file\n");
@@ -334,7 +334,7 @@ SNAPSHOT_LOAD_MEMBER( lviv_state, lviv )
if(lviv_verify_snapshot(lviv_snapshot_data, snapshot_size) == IMAGE_VERIFY_FAIL)
{
- free(lviv_snapshot_data);
+ global_free_array(lviv_snapshot_data);
return IMAGE_INIT_FAIL;
}
@@ -342,7 +342,7 @@ SNAPSHOT_LOAD_MEMBER( lviv_state, lviv )
dump_registers();
- free(lviv_snapshot_data);
+ global_free_array(lviv_snapshot_data);
logerror("Snapshot file loaded\n");
return IMAGE_INIT_PASS;
diff --git a/src/mess/machine/microtan.c b/src/mess/machine/microtan.c
index c4250f5b13b..f7da67aa36b 100644
--- a/src/mess/machine/microtan.c
+++ b/src/mess/machine/microtan.c
@@ -840,7 +840,7 @@ QUICKLOAD_LOAD_MEMBER( microtan_state, microtan )
int rc;
snapshot_size = 8263; /* magic size */
- snapshot_buff = (UINT8*)malloc(snapshot_size);
+ snapshot_buff = global_alloc_array(UINT8, snapshot_size);
if (!snapshot_buff)
{
logerror("microtan_hexfile_load: could not allocate %d bytes of buffer\n", snapshot_size);
@@ -848,10 +848,10 @@ QUICKLOAD_LOAD_MEMBER( microtan_state, microtan )
}
memset(snapshot_buff, 0, snapshot_size);
- buff = (char*)malloc(quickload_size + 1);
+ buff = global_alloc_array(char, quickload_size + 1);
if (!buff)
{
- free(snapshot_buff);
+ global_free_array(snapshot_buff);
logerror("microtan_hexfile_load: could not allocate %d bytes of buffer\n", quickload_size);
return IMAGE_INIT_FAIL;
}
@@ -865,6 +865,7 @@ QUICKLOAD_LOAD_MEMBER( microtan_state, microtan )
rc = parse_zillion_hex(snapshot_buff, buff);
if (rc == IMAGE_INIT_PASS)
microtan_snapshot_copy(snapshot_buff, snapshot_size);
- free(snapshot_buff);
+ global_free_array(buff);
+ global_free_array(snapshot_buff);
return rc;
}
diff --git a/src/mess/machine/nc.c b/src/mess/machine/nc.c
index 7933259b453..7bc56cab3af 100644
--- a/src/mess/machine/nc.c
+++ b/src/mess/machine/nc.c
@@ -61,8 +61,8 @@ int nc_state::nc_card_load(device_image_interface &image, unsigned char **ptr)
if (datasize!=0)
{
- /* malloc memory for this data */
- data = (unsigned char *)malloc(datasize);
+ /* alloc memory for this data */
+ data = global_alloc_array(unsigned char, datasize);
if (data!=NULL)
{
@@ -130,7 +130,7 @@ DEVICE_IMAGE_UNLOAD_MEMBER( nc_state, nc_pcmcia_card )
/* free ram allocated to card */
if (m_card_ram!=NULL)
{
- free(m_card_ram);
+ global_free_array(m_card_ram);
m_card_ram = NULL;
}
m_card_size = 0;
diff --git a/src/mess/machine/primo.c b/src/mess/machine/primo.c
index 759ad9192c3..2555ec25cfe 100644
--- a/src/mess/machine/primo.c
+++ b/src/mess/machine/primo.c
@@ -301,24 +301,24 @@ SNAPSHOT_LOAD_MEMBER( primo_state, primo )
{
UINT8 *snapshot_data;
- if (!(snapshot_data = (UINT8*) malloc(snapshot_size)))
+ if (!(snapshot_data = global_alloc_array(UINT8, snapshot_size)))
return IMAGE_INIT_FAIL;
if (image.fread( snapshot_data, snapshot_size) != snapshot_size)
{
- free(snapshot_data);
+ global_free_array(snapshot_data);
return IMAGE_INIT_FAIL;
}
if (strncmp((char *)snapshot_data, "PS01", 4))
{
- free(snapshot_data);
+ global_free_array(snapshot_data);
return IMAGE_INIT_FAIL;
}
primo_setup_pss(snapshot_data, snapshot_size);
- free(snapshot_data);
+ global_free_array(snapshot_data);
return IMAGE_INIT_PASS;
}
@@ -352,17 +352,17 @@ QUICKLOAD_LOAD_MEMBER( primo_state, primo )
{
UINT8 *quickload_data;
- if (!(quickload_data = (UINT8*) malloc(quickload_size)))
+ if (!(quickload_data = global_alloc_array(UINT8, quickload_size)))
return IMAGE_INIT_FAIL;
if (image.fread( quickload_data, quickload_size) != quickload_size)
{
- free(quickload_data);
+ global_free_array(quickload_data);
return IMAGE_INIT_FAIL;
}
primo_setup_pp(quickload_data, quickload_size);
- free(quickload_data);
+ global_free_array(quickload_data);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/machine/spec_snqk.c b/src/mess/machine/spec_snqk.c
index bb7417155dc..c076197e0d2 100644
--- a/src/mess/machine/spec_snqk.c
+++ b/src/mess/machine/spec_snqk.c
@@ -114,7 +114,7 @@ SNAPSHOT_LOAD_MEMBER( spectrum_state,spectrum)
{
UINT8 *snapshot_data = NULL;
- snapshot_data = (UINT8*)malloc(snapshot_size);
+ snapshot_data = global_alloc_array(UINT8, snapshot_size);
if (!snapshot_data)
goto error;
@@ -233,13 +233,13 @@ SNAPSHOT_LOAD_MEMBER( spectrum_state,spectrum)
spectrum_setup_z80(machine(), snapshot_data, snapshot_size);
}
- free(snapshot_data);
+ global_free_array(snapshot_data);
return IMAGE_INIT_PASS;
error:
if (snapshot_data)
- free(snapshot_data);
+ global_free_array(snapshot_data);
return IMAGE_INIT_FAIL;
}
@@ -2455,7 +2455,7 @@ QUICKLOAD_LOAD_MEMBER( spectrum_state,spectrum)
{
UINT8 *quickload_data = NULL;
- quickload_data = (UINT8*)malloc(quickload_size);
+ quickload_data = global_alloc_array(UINT8, quickload_size);
if (!quickload_data)
goto error;
@@ -2480,13 +2480,13 @@ QUICKLOAD_LOAD_MEMBER( spectrum_state,spectrum)
spectrum_setup_raw(machine(), quickload_data, quickload_size);
}
- free(quickload_data);
+ global_free_array(quickload_data);
return IMAGE_INIT_PASS;
error:
if (quickload_data)
- free(quickload_data);
+ global_free_array(quickload_data);
return IMAGE_INIT_FAIL;
}
diff --git a/src/mess/machine/ti85.c b/src/mess/machine/ti85.c
index a9ad0d8f598..e384863169c 100644
--- a/src/mess/machine/ti85.c
+++ b/src/mess/machine/ti85.c
@@ -694,7 +694,7 @@ SNAPSHOT_LOAD_MEMBER( ti85_state, ti8x )
return IMAGE_INIT_FAIL;
}
- if (!(ti8x_snapshot_data = (UINT8*)malloc(snapshot_size)))
+ if (!(ti8x_snapshot_data = global_alloc_array(UINT8, snapshot_size)))
return IMAGE_INIT_FAIL;
image.fread( ti8x_snapshot_data, snapshot_size);
@@ -704,6 +704,6 @@ SNAPSHOT_LOAD_MEMBER( ti85_state, ti8x )
else if (!strncmp(machine().system().name, "ti86", 4))
ti86_setup_snapshot(ti8x_snapshot_data);
- free(ti8x_snapshot_data);
+ global_free_array(ti8x_snapshot_data);
return IMAGE_INIT_PASS;
}
diff --git a/src/mess/machine/ti99/datamux.c b/src/mess/machine/ti99/datamux.c
index 77ff2412312..5985a537156 100644
--- a/src/mess/machine/ti99/datamux.c
+++ b/src/mess/machine/ti99/datamux.c
@@ -392,7 +392,7 @@ void ti99_datamux_device::device_start(void)
void ti99_datamux_device::device_stop(void)
{
- if (m_ram16b) free(m_ram16b);
+ if (m_ram16b) global_free_array(m_ram16b);
}
void ti99_datamux_device::device_reset(void)
@@ -410,7 +410,7 @@ void ti99_datamux_device::device_reset(void)
// better use a region?
if (m_ram16b==NULL)
{
- m_ram16b = (UINT16*)malloc(32768);
+ m_ram16b = global_alloc_array(UINT16, 32768/2);
memset(m_ram16b, 0, 32768);
}
diff --git a/src/mess/machine/ti99/gromport.c b/src/mess/machine/ti99/gromport.c
index 6ea40667601..083e379f3ef 100644
--- a/src/mess/machine/ti99/gromport.c
+++ b/src/mess/machine/ti99/gromport.c
@@ -2337,7 +2337,7 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy
if (header == NULL) throw rpk_exception(RPK_MISSING_LAYOUT);
/* reserve space for the layout file contents (+1 for the termination) */
- layout_text = (char*)malloc(header->uncompressed_length + 1);
+ layout_text = global_alloc_array(char, header->uncompressed_length + 1);
if (layout_text == NULL) throw rpk_exception(RPK_OUT_OF_MEMORY);
/* uncompress the layout text */
@@ -2429,14 +2429,14 @@ rpk* rpk_reader::open(emu_options &options, const char *filename, const char *sy
{
newrpk->close();
if (zipfile != NULL) zip_file_close(zipfile);
- if (layout_text != NULL) free(layout_text);
+ if (layout_text != NULL) global_free_array(layout_text);
// rethrow the exception
throw exp;
}
if (zipfile != NULL) zip_file_close(zipfile);
- if (layout_text != NULL) free(layout_text);
+ if (layout_text != NULL) global_free_array(layout_text);
return newrpk;
}
diff --git a/src/mess/machine/x68k_hdc.c b/src/mess/machine/x68k_hdc.c
index 65a5bfbdeb2..467ad1045cd 100644
--- a/src/mess/machine/x68k_hdc.c
+++ b/src/mess/machine/x68k_hdc.c
@@ -265,11 +265,11 @@ WRITE16_MEMBER( x68k_hdc_image_device::hdc_w )
lba |= m_command[2] << 8;
lba |= (m_command[1] & 0x1f) << 16;
fseek(lba * 256,SEEK_SET);
- blk = (char*)malloc(256*33);
+ blk = global_alloc_array(char, 256*33);
memset(blk,0,256*33);
// formats 33 256-byte blocks
fwrite(blk,256*33);
- free(blk);
+ global_free_array(blk);
logerror("SASI: FORMAT UNIT (LBA 0x%06x)\n",lba);
break;
default: