use safe_malloc_info instead of unreachable code
This commit is contained in:
parent
de8171f1ea
commit
e4eae18f5f
|
|
@ -516,10 +516,7 @@ void LoadPCX( const char *filename, byte **pic, byte **palette, int *width, int
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = safe_malloc( ( pcx->ymax + 1 ) * ( pcx->xmax + 1 ) );
|
out = safe_malloc_info( ( pcx->ymax + 1 ) * ( pcx->xmax + 1 ), "LoadPCX" );
|
||||||
if ( !out ) {
|
|
||||||
Error( "LoadPCX: couldn't allocate" );
|
|
||||||
}
|
|
||||||
|
|
||||||
*pic = out;
|
*pic = out;
|
||||||
pix = out;
|
pix = out;
|
||||||
|
|
@ -1005,11 +1002,7 @@ void LoadTGABuffer( const byte *f, const byte *enddata, byte **pic, int *width,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
image_rgba = safe_malloc( image_width * image_height * 4 );
|
image_rgba = safe_malloc_info( image_width * image_height * 4, "LoadTGABuffer" );
|
||||||
if ( !image_rgba ) {
|
|
||||||
Sys_Printf( "LoadTGA: not enough memory for %i by %i image\n", image_width, image_height );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If bit 5 of attributes isn't set, the image has been stored from bottom to top
|
// If bit 5 of attributes isn't set, the image has been stored from bottom to top
|
||||||
if ( ( targa_header.attributes & 0x20 ) == 0 ) {
|
if ( ( targa_header.attributes & 0x20 ) == 0 ) {
|
||||||
|
|
|
||||||
|
|
@ -2172,10 +2172,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, qboolean fastAllocate ){
|
||||||
if ( ok == qfalse ) {
|
if ( ok == qfalse ) {
|
||||||
/* allocate LIGHTMAP_RESERVE_COUNT new output lightmaps */
|
/* allocate LIGHTMAP_RESERVE_COUNT new output lightmaps */
|
||||||
numOutLightmaps += LIGHTMAP_RESERVE_COUNT;
|
numOutLightmaps += LIGHTMAP_RESERVE_COUNT;
|
||||||
olm = safe_malloc( numOutLightmaps * sizeof( outLightmap_t ) );
|
olm = safe_malloc_info( numOutLightmaps * sizeof( outLightmap_t ), "FindOutLightmaps" );
|
||||||
if ( !olm ){
|
|
||||||
Error( "FindOutLightmaps: Failed to allocate memory.\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( outLightmaps != NULL && numOutLightmaps > LIGHTMAP_RESERVE_COUNT ) {
|
if ( outLightmaps != NULL && numOutLightmaps > LIGHTMAP_RESERVE_COUNT ) {
|
||||||
memcpy( olm, outLightmaps, ( numOutLightmaps - LIGHTMAP_RESERVE_COUNT ) * sizeof( outLightmap_t ) );
|
memcpy( olm, outLightmaps, ( numOutLightmaps - LIGHTMAP_RESERVE_COUNT ) * sizeof( outLightmap_t ) );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user