Beef up unit tests for SI95 code
[ric-plt/lib/rmr.git] / src / rmr / si / src / si95 / sitrash.c
index efc2cd3..83671c7 100644 (file)
@@ -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 ) {