X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsiwait.c;h=291b8aad807b515052b3eede2e3355c2bd46da6f;hb=f8623e7dc17184b3359a5de8a81a54bb963469c7;hp=0d1e3e54616bdc53adaa8d20affd7e9c78d953e0;hpb=5861625ff2eaf1bd3a69ce488bd7d14f7b402432;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/siwait.c b/src/rmr/si/src/si95/siwait.c index 0d1e3e5..291b8aa 100644 --- a/src/rmr/si/src/si95/siwait.c +++ b/src/rmr/si/src/si95/siwait.c @@ -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; } @@ -93,7 +98,8 @@ extern int SIwait( struct ginfo_blk *gptr ) { } if( pstat > 0 && (! (gptr->flags & GIF_SHUTDOWN)) ) { - for( tpptr = gptr->tplist; tpptr != NULL; tpptr = nextone ) { + tpptr = gptr->tplist; + while( tpptr != NULL ) { nextone = tpptr->next; // prevent issues if we delete the block during loop if( tpptr->fd >= 0 ) { @@ -129,6 +135,8 @@ extern int SIwait( struct ginfo_blk *gptr ) { } } } // if still good fd + + tpptr = nextone; } } } while( gptr->tplist != NULL && !(gptr->flags & GIF_SHUTDOWN) );