X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsitrash.c;h=83671c78eef55eb7446ac4777d48ff1fdaf2d822;hb=11838bcf76f3614384459cb56e2ce80dea788cef;hp=efc2cd3a37b3190ffdd1401a1d3cecd6835dc175;hpb=ec88d3c0563eeb6ae5f73427edb0b3c4d7acf299;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/sitrash.c b/src/rmr/si/src/si95/sitrash.c index efc2cd3..83671c7 100644 --- a/src/rmr/si/src/si95/sitrash.c +++ b/src/rmr/si/src/si95/sitrash.c @@ -40,6 +40,10 @@ extern void SItrash( int type, void *bp ) struct ioq_blk *iptr; struct ioq_blk *inext; + if( bp == NULL ) { + return; + } + switch( type ) { case IOQ_BLK: @@ -51,12 +55,15 @@ extern void SItrash( int type, void *bp ) case TP_BLK: // we assume its off the list tp = (struct tp_blk *) bp; - for( iptr = tp->squeue; iptr; iptr = inext ) // trash any pending send buffers - { + iptr = tp->squeue; + while( iptr != NULL ) { inext = iptr->next; + free( iptr->data ); // we could recurse, but that seems silly free( iptr->addr ); free( iptr ); + + iptr = inext; } if( tp->fd >= 0 ) {