X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fwebcc.git;a=blobdiff_plain;f=src%2Fapc%2Firmem.c;h=1e0024f1906342ec300016b1f75802f83d2c3702;hp=dc5cede44649e33a11d3c62a3be966612b6bd6af;hb=34fce8bbbe19608d819991617f8551a1fa1f0e99;hpb=1214d43da1ccaea8d3c0d50a975a9f68eb634660 diff --git a/src/apc/irmem.c b/src/apc/irmem.c index dc5cede..1e0024f 100644 --- a/src/apc/irmem.c +++ b/src/apc/irmem.c @@ -85,20 +85,26 @@ struct link* link_buf[PTRS_IN_PAGE]; /* The initalization function of the IR. */ -void +int ir_init() { /* Init root cdat and stack */ char root[4] = "root"; - cdat_buf[num_cdats] = (struct cdat*) malloc(sizeof(struct cdat) ); + if( (cdat_buf[num_cdats] = (struct cdat*) malloc(sizeof(struct cdat))) == NULL) + { + perror("malloc root class failed\n"); + return -1; + } cdat_buf[num_cdats]->idx = num_cdats; memmove(cdat_buf[num_cdats]->name, root, 4); cdat_stackp = cdat_stack; *cdat_stackp++ = cdat_buf[num_cdats++]; + return 0; + } void