X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsinewses.c;h=8665892ddd6d9ac97b183e62e80fede384a90884;hb=fa454008020483ac35e1d20300cddfe877d8dd6d;hp=02a5e6db0ae766d2b4f697700bc995dc10b6abd3;hpb=cc314e0c526a0ed0ce9295e490b3f2bb29c3332c;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/sinewses.c b/src/rmr/si/src/si95/sinewses.c index 02a5e6d..8665892 100644 --- a/src/rmr/si/src/si95/sinewses.c +++ b/src/rmr/si/src/si95/sinewses.c @@ -52,6 +52,7 @@ extern int SInewsession( struct ginfo_blk *gptr, struct tp_blk *tpptr ) { 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 ) { @@ -88,12 +89,12 @@ extern int SInewsession( struct ginfo_blk *gptr, struct tp_blk *tpptr ) { } 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 { @@ -110,6 +111,7 @@ extern int SInewsession( struct ginfo_blk *gptr, struct tp_blk *tpptr ) { SImap_fd( gptr, newtp->fd, newtp ); // add fd to the map + free( buf ); return SI_OK; }