addr = (struct sockaddr *) malloc( sizeof( struct sockaddr ) );
addrlen = sizeof( struct sockaddr );
+ memset( addr, 0, sizeof( struct sockaddr ) );
status = accept( tpptr->fd, addr, &addrlen ); // accept and assign new fd (status)
if( status < 0 ) {
}
SETSOCKOPT( tpptr->fd, SOL_TCP, TCP_QUICKACK, (void *)&optval, sizeof( optval) ) ;
- SIaddress( addr, (void **) &buf, AC_TODOT ); // get addr of remote side
- if( (cbptr = gptr->cbtab[SI_CB_SECURITY].cbrtn) != NULL ) { // invoke the security callback function if there
+ SIaddress( addr, (void **) &buf, AC_TODOT ); // get addr of remote side; buf must be freed
+ if( (cbptr = gptr->cbtab[SI_CB_SECURITY].cbrtn) != NULL ) { // invoke the security callback function if there
status = (*cbptr)( gptr->cbtab[SI_CB_SECURITY].cbdata, buf );
if( status == SI_RET_ERROR ) { // session to be rejected
SIterm( gptr, newtp ); // terminate new tp block (do NOT call trash)
- free( addr );
+ // free( addr ); // not required, will be eventually freed by SItrash
free( buf );
return SI_ERROR;
} else {
SImap_fd( gptr, newtp->fd, newtp ); // add fd to the map
+ free( buf );
return SI_OK;
}