Changeset 2649


Ignore:
Timestamp:
Aug 2, 2008, 11:24:36 PM (15 years ago)
Author:
Pascal Terjan
Message:
  • Check a few more realloc, and return when they fail
File:
1 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/configuration.c

    r2648 r2649  
    214214
    215215    cur = malloc(1);
     216    if(!cur)
     217    {
     218        fprintf(stderr, "Can't allocate memory at %s:%d\n",
     219                __FUNCTION__, __LINE__);
     220        return -1;
     221    }
    216222    cur[0] = 0;
    217223
     
    226232            cur[o-end_spaces] = 0;
    227233            cur = realloc(cur, (o-end_spaces)+1);
     234            if(!cur)
     235            {
     236                fprintf(stderr, "Can't allocate memory at %s:%d\n",
     237                       __FUNCTION__, __LINE__);
     238                return -1;
     239            }
    228240            o = 0;
    229241            option->key = cur;
     
    238250            if(!cur)
    239251            {
    240                 printf(stderr, "Can't allocate memory at %s:%d\n",
     252                fprintf(stderr, "Can't allocate memory at %s:%d\n",
    241253                       __FUNCTION__, __LINE__);
     254                return -1;
    242255            }
    243256            cur[o]   = line[i];
Note: See TracChangeset for help on using the changeset viewer.