Code Review
/
ric-plt
/
lib
/
rmr.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
fixing RMR messages with negative size
[ric-plt/lib/rmr.git]
/
src
/
rmr
/
si
/
src
/
si95
/
sitrash.c
diff --git
a/src/rmr/si/src/si95/sitrash.c
b/src/rmr/si/src/si95/sitrash.c
index
679e2f4
..
33c6801
100644
(file)
--- a/
src/rmr/si/src/si95/sitrash.c
+++ b/
src/rmr/si/src/si95/sitrash.c
@@
-20,26
+20,30
@@
/*
***************************************************************************
/*
***************************************************************************
-*
+*
* Mnemonic: sitrash
* Abstract: Delete all things referenced by a struct and then free the memory.
* Mnemonic: sitrash
* Abstract: Delete all things referenced by a struct and then free the memory.
-*
+*
* Returns: Nothing
* Date: 08 March 2007
* Returns: Nothing
* Date: 08 March 2007
-* Author: E. Scott Daniels
+* Author: E. Scott Daniels
*
*
-******************************************************************************
+******************************************************************************
*/
#include "sisetup.h"
#include "sitransport.h"
*/
#include "sisetup.h"
#include "sitransport.h"
-
+
extern void SItrash( int type, void *bp )
{
struct tp_blk *tp = NULL;
struct ioq_blk *iptr;
struct ioq_blk *inext;
extern void SItrash( int type, void *bp )
{
struct tp_blk *tp = NULL;
struct ioq_blk *iptr;
struct ioq_blk *inext;
+ if( bp == NULL ) {
+ return;
+ }
+
switch( type )
{
case IOQ_BLK:
switch( type )
{
case IOQ_BLK:
@@
-48,14
+52,14
@@
extern void SItrash( int type, void *bp )
free( iptr->addr );
free( iptr );
break;
free( iptr->addr );
free( iptr );
break;
-
- case TP_BLK: // we assume its off the list
+
+ case TP_BLK: // we assume its off the list
tp = (struct tp_blk *) bp;
tp = (struct tp_blk *) bp;
- iptr = tp->squeue;
+ iptr = tp->squeue;
while( iptr != NULL ) {
inext = iptr->next;
while( iptr != NULL ) {
inext = iptr->next;
- free( iptr->data ); // we could recurse, but that seems silly
+ free( iptr->data ); // we could recurse, but that seems silly
free( iptr->addr );
free( iptr );
free( iptr->addr );
free( iptr );
@@
-65,10
+69,10
@@
extern void SItrash( int type, void *bp )
if( tp->fd >= 0 ) {
CLOSE( tp->fd );
}
if( tp->fd >= 0 ) {
CLOSE( tp->fd );
}
-
- free( tp->addr ); // release the address bufers
- free( tp->paddr );
- free( tp ); // and release the block
+
+ free( tp->addr ); // release the address bufers
+ free( tp->paddr );
+ free( tp ); // and release the block
break;
}
}
break;
}
}