free allocated memory for iRCCE_MAIL_HEADER now; call iRCCE_finalize() in icc_halt()

This commit is contained in:
Generic account for RWTHAachen Students 2011-06-06 06:45:17 -07:00
parent ddc72ef51e
commit 521c3e1bc9
4 changed files with 23 additions and 2 deletions

View file

@ -134,6 +134,7 @@ typedef struct _iRCCE_MAIL_TRASH_BIN {
//
// Initialize/Finalize functions:
int iRCCE_init(void);
int iRCCE_finalize(void);
//
// Non-blocking send/recv functions:
int iRCCE_isend(char *, ssize_t, int, iRCCE_SEND_REQUEST *);

View file

@ -109,4 +109,23 @@ int iRCCE_init(void) {
return (iRCCE_SUCCESS);
}
//--------------------------------------------------------------------------------------
// FUNCTION: iRCCE_finalize
//--------------------------------------------------------------------------------------
// finalize the library
//--------------------------------------------------------------------------------------
int iRCCE_finalize(void) {
// empty iRCCE_mail_garbage
iRCCE_MAIL_HEADER* run;
iRCCE_MAIL_HEADER* erase_header;
for( run = iRCCE_mail_garbage.first; run != NULL; ) {
erase_header = run;
run = run->next;
kfree( erase_header, sizeof(iRCCE_MAIL_HEADER) );
}
iRCCE_mail_garbage.first = iRCCE_mail_garbage.last = NULL;
return iRCCE_SUCCESS;
}
#endif

View file

@ -119,8 +119,7 @@ static int iRCCE_mail_fetch(
// routine to check for new mail in mailboxes
//------------------------------------------------------------------------------
static int iRCCE_mailbox_check() {
int i, j;
int tmp;
int i;
for( i=0; i<RCCE_NP; ++i ) {
// only check open mailboxes

View file

@ -190,6 +190,8 @@ int icc_halt(void)
irq_nested_enable(flags);
} while(do_send);
iRCCE_finalize();
HALT;
return 0;