Ignore:
Timestamp:
Nov 14, 2003, 6:02:36 PM (19 years ago)
Author:
Sam Hocevar
Message:
  • Sanity checks after each malloc() call.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk/src/main.c

    r154 r174  
    3737{
    3838    game *g = malloc(sizeof(game));
     39    if(g == NULL)
     40        exit(1);
    3941
    4042    srand(time(NULL));
     
    7173    g->sf = create_starfield(g);
    7274    g->wp = malloc(sizeof(weapons));
     75    if(g->wp == NULL)
     76        exit(1);
    7377    g->ex = malloc(sizeof(explosions));
     78    if(g->ex == NULL)
     79        exit(1);
    7480    g->bo = malloc(sizeof(bonus));
     81    if(g->bo == NULL)
     82        exit(1);
    7583    g->t = create_tunnel(g, g->w, g->h);
    7684    g->p = create_player(g);
    7785    g->al = malloc(sizeof(aliens));
     86    if(g->al == NULL)
     87        exit(1);
    7888
    7989    init_bonus(g, g->bo);
Note: See TracChangeset for help on using the changeset viewer.