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