mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-14 00:41:08 +00:00
use g_malloc and g_free everywhere - causes Windows only crashes
This commit is contained in:
parent
03bf78c43f
commit
233c1f257e
2 changed files with 5 additions and 5 deletions
|
@ -317,7 +317,7 @@ static void LoadPCX( const char *filename, byte **pic, byte **palette, int *widt
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( palette ) {
|
if ( palette ) {
|
||||||
*palette = (byte *)malloc( 768 );
|
*palette = (byte *)g_malloc( 768 );
|
||||||
memcpy( *palette, (byte *)pcx + len - 768, 768 );
|
memcpy( *palette, (byte *)pcx + len - 768, 768 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ static void LoadPCX( const char *filename, byte **pic, byte **palette, int *widt
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = (byte *)malloc( ( pcx->ymax + 1 ) * ( pcx->xmax + 1 ) );
|
out = (byte *)g_malloc( ( pcx->ymax + 1 ) * ( pcx->xmax + 1 ) );
|
||||||
if ( !out ) {
|
if ( !out ) {
|
||||||
Error( "LoadPCX: couldn't allocate" );
|
Error( "LoadPCX: couldn't allocate" );
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ static void LoadPCX( const char *filename, byte **pic, byte **palette, int *widt
|
||||||
if ( raw - (byte *) pcx > len ) {
|
if ( raw - (byte *) pcx > len ) {
|
||||||
Error( "PCX file %s was malformed", filename );
|
Error( "PCX file %s was malformed", filename );
|
||||||
}
|
}
|
||||||
free( pcx );
|
g_free( pcx );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -525,7 +525,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
||||||
len = ftell( f );
|
len = ftell( f );
|
||||||
rewind( f );
|
rewind( f );
|
||||||
|
|
||||||
*bufferptr = malloc( len + 1 );
|
*bufferptr = g_malloc( len + 1 );
|
||||||
if ( *bufferptr == NULL ) {
|
if ( *bufferptr == NULL ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
||||||
if ( count == index ) {
|
if ( count == index ) {
|
||||||
fseek( file->pak, file->entry.offset, SEEK_SET );
|
fseek( file->pak, file->entry.offset, SEEK_SET );
|
||||||
|
|
||||||
*bufferptr = malloc( file->entry.size + 1 );
|
*bufferptr = g_malloc( file->entry.size + 1 );
|
||||||
// we need to end the buffer with a 0
|
// we need to end the buffer with a 0
|
||||||
( (char*) ( *bufferptr ) )[file->entry.size] = 0;
|
( (char*) ( *bufferptr ) )[file->entry.size] = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue