Skip to content

Commit

Permalink
Fixed the spawn bug(I hope becouse I just tested few times...)
Browse files Browse the repository at this point in the history
Checked all NULL ptr and used calloc instead malloc to prevent some invalid NULL check.
  • Loading branch information
whitedragon0000 committed Dec 31, 2017
1 parent d2afcc6 commit 00ee658
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion engine/openbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -14197,7 +14197,7 @@ void load_level(char *filename)

// Allocate memory for player spawn - only as much as we need.
player_max = levelsets[current_set].maxplayers;
level->spawn = malloc( (sizeof(*level->spawn) * MAX_PLAYERS) );
level->spawn = calloc(player_max, sizeof(*level->spawn));

// Default player spawn Y position just above the screen top.
for(i = 0; i < player_max && level->spawn; i++)
Expand Down

0 comments on commit 00ee658

Please sign in to comment.