Fixing minor exception checks
[ric-plt/lib/rmr.git] / src / rmr / si / src / si95 / siwait.c
index 6a72b30..291b8aa 100644 (file)
@@ -69,14 +69,19 @@ extern int SIwait( struct ginfo_blk *gptr ) {
        char *buf;
        char *ibuf;
 
-       ibuf = (char *) malloc( 2048 );
+       if( ( ibuf = (char *) malloc( 2048 ) ) == NULL ) {
+                       rmr_vlog( RMR_VL_WARN, "ibuf malloc fail\n" );
+                       return SI_ERROR;
+       }
 
        if( gptr->flags & GIF_SHUTDOWN ) {                              //  cannot do if we should shutdown 
+               free( ibuf );
                return SI_ERROR;                                                        //  so just get out 
        }
 
        if( gptr->magicnum != MAGICNUM ) {                              //  if not a valid ginfo block 
                rmr_vlog( RMR_VL_CRIT, "SI95: wait: bad global info struct magic number is wrong\n" );
+               free( ibuf );
                return SI_ERROR;
        }