From: Jan Pospíšil Date: Thu, 8 Jun 2006 13:57:09 +0000 (+0000) Subject: InitEvent now returns NULL if calloc fails X-Git-Tag: gridsite-core_R_1_3_1~12 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=301f2c9fe8d8a6bd69ed17eff94d437c35c9c06e;p=jra1mw.git InitEvent now returns NULL if calloc fails --- diff --git a/org.glite.lb.common/src/events.c.T b/org.glite.lb.common/src/events.c.T index 4ceee87..4de3c32 100644 --- a/org.glite.lb.common/src/events.c.T +++ b/org.glite.lb.common/src/events.c.T @@ -252,11 +252,12 @@ edg_wll_Event *edg_wll_InitEvent( edg_wll_EventCode eventcode /* eventcode IN */ ) { -edg_wll_Event *event; +edg_wll_Event *event=NULL; /* allocate memory for 'event' (edg_wll_Event); use calloc to also clean it */ -/* FIXME: what if calloc fails? should be checked somehow -> nomem etc. */ event = (edg_wll_Event *) calloc(1,sizeof(edg_wll_Event)); + if (event == NULL) return event; + event->type = eventcode; /* initialize common fields */ @@@{