InitEvent now returns NULL if calloc fails
authorJan Pospíšil <honik@ntc.zcu.cz>
Thu, 8 Jun 2006 13:57:09 +0000 (13:57 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Thu, 8 Jun 2006 13:57:09 +0000 (13:57 +0000)
org.glite.lb.common/src/events.c.T

index 4ceee87..4de3c32 100644 (file)
@@ -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 */
 @@@{