summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/g_buildable.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 870fa6fe..e2bc16a8 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -3795,7 +3795,7 @@ void G_LayoutLoad( void )
{
fileHandle_t f;
int len;
- char *layout;
+ char *layout, *layoutHead;
char map[ MAX_QPATH ];
int buildable = BA_NONE;
vec3_t origin = { 0.0f, 0.0f, 0.0f };
@@ -3816,9 +3816,9 @@ void G_LayoutLoad( void )
G_Printf( "ERROR: layout %s could not be opened\n", level.layout );
return;
}
- layout = BG_Alloc( len + 1 );
+ layoutHead = layout = BG_Alloc( len + 1 );
trap_FS_Read( layout, len, f );
- *( layout + len ) = '\0';
+ layout[ len ] = '\0';
trap_FS_FCloseFile( f );
while( *layout )
{
@@ -3826,7 +3826,7 @@ void G_LayoutLoad( void )
{
G_Printf( S_COLOR_RED "ERROR: line overflow in %s before \"%s\"\n",
va( "layouts/%s/%s.dat", map, level.layout ), line );
- return;
+ break;
}
line[ i++ ] = *layout;
line[ i ] = '\0';
@@ -3848,6 +3848,7 @@ void G_LayoutLoad( void )
}
layout++;
}
+ BG_Free( layoutHead );
}
/*