[Epic-ID: ODUHIGH-475][Task-ID: ODUHIGH-476]Integration fixes upto PRACH scheduling...
[o-du/l2.git] / src / cm / cm_inet.c
index 78c7640..69f8035 100644 (file)
 \f  
 /* header include files (.h) */
   
-#include "envopt.h"             /* environment options */  
-#include "envdep.h"             /* environment dependent */
-#include "envind.h"             /* environment independent */
-
-#include "gen.h"                /* general */
-#include "ssi.h"                /* system services interface */
+#include "common_def.h"  
 #include "cm_inet.h"            /* socket library file */
 
 /*cm_inet_c_001.main_35 : Updated for C++ compilation */
@@ -145,14 +140,10 @@ extern "C" {
 #endif /* __cplusplus */
 /* header/extern include files (.x) */
 
-#include "gen.x"                /* general */
-#include "ssi.x"                /* system services interface */
 #include "cm_inet.x"            /* socket library file */
-#include "cm_lib.x"             /* lib library file */
 #ifdef NTL_LIB
 #include "ntl_lib.h"
 #endif 
-#include "du_log.h"
 
 \f  
 /* local defines */
@@ -2307,21 +2298,20 @@ uint32_t        context       /* value to be passed back, if error occurs */
    MsgLen  msgLen = 0;              /* message length */    
    MsgLen  bufLen = 0;              /* send buffer length */     
    Data   *sendBuf = NULLP;             /* plain send buffer */
-   uint32_t     flags;
+   uint32_t     flags =0;
    CmInetSockAddr *sockAddrPtr = NULLP;
    /* cm_inet_c_001.main_58 : Fix for klockwork issue */
    MsgLen          sockAddrLen = 0; 
-   struct sockaddr_in  addr;
+   struct sockaddr_in  addr ={0};
 #ifdef IPV6_SUPPORTED
 #ifdef SUN_KSCTP
    S8     *addrString = NULLP;
    uint32_t    addrLen = 0;
    S8     ipv4Format[23] = "::ffff:";
-   CmInetIpAddr ipv4NetAddr;
+   CmInetIpAddr ipv4NetAddr = {0};
 #endif /* SUN_KSCTP */
-   struct sockaddr_in6  addr6;
+   struct sockaddr_in6  addr6 ={0};
 #endif /* IPV6_SUPPORTED */
-
 #if (ERRCLASS & ERRCLS_INT_PAR)
    /* error check on parameters */
    if ((sockFd == NULLP) || CM_INET_INV_SOCK_FD(sockFd)
@@ -2349,7 +2339,7 @@ uint32_t        context       /* value to be passed back, if error occurs */
    {
       return RFAILED;
    }
-   ret = SGetSBuf(info->region, info->pool, &sendBuf, bufLen);                  
+   ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, &sendBuf, bufLen);                  
    if (ret != ROK)
    {
       return (ROUTRES);
@@ -2357,7 +2347,7 @@ uint32_t        context       /* value to be passed back, if error occurs */
    ret = SCpyMsgFix(mBuf, 0, bufLen, sendBuf, &msgLen);
    if ((ret != ROK) || (msgLen != bufLen)) 
    {
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);       
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);       
       return RFAILED;
    }
 
@@ -2368,7 +2358,7 @@ uint32_t        context       /* value to be passed back, if error occurs */
       {
          if (sockFd->protType == AF_INET)
          {
-            SPutSBuf(info->region, info->pool, sendBuf, bufLen);       
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);       
 #ifdef CMINETDBG
 #ifndef ALIGN_64BIT
             /* cm_inet_c_001.main_54: CMINETLOGERROR added insted of SDisp */
@@ -2477,7 +2467,7 @@ uint32_t        context       /* value to be passed back, if error occurs */
          ppId, flags, strmId, ttl, context);
    if (ret == INET_ERR)
    {
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);       
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);       
 #ifdef CMINETDBG
 #ifndef ALIGN_64BIT
       /* cm_inet_c_001.main_54: CMINETLOGERROR added insted of SDisp */
@@ -2508,7 +2498,7 @@ uint32_t        context       /* value to be passed back, if error occurs */
    *len = (MsgLen)ret; 
 
    /* cleanup */
-   SPutSBuf(info->region, info->pool, sendBuf, bufLen);       
+   SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);       
 
    return ROK;
 }
@@ -2575,7 +2565,7 @@ CmInetSctpNotification *ntfy        /* notification parameters */
    buflen = CM_INET_MAX_MSG_LEN;
 
    /* allocate flat receive buffer */
-   ret = SGetSBuf(meminfo->region, meminfo->pool, &recvbuf, buflen);
+   ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,meminfo->region, meminfo->pool, &recvbuf, buflen);
    if (ret != ROK)
    {
 #ifdef CMINETDBG
@@ -2598,7 +2588,7 @@ CmInetSctpNotification *ntfy        /* notification parameters */
    if (ret == INET_ERR)
    {
       /* cleanup */
-      SPutSBuf(meminfo->region, meminfo->pool, recvbuf, buflen);       
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,meminfo->region, meminfo->pool, recvbuf, buflen);       
 #ifdef CMINETDBG
 #ifndef ALIGN_64BIT
       /* cm_inet_c_001.main_54: CMINETLOGERROR added insted of SDisp */
@@ -2772,7 +2762,7 @@ CmInetSctpNotification *ntfy        /* notification parameters */
             /* cm_inet_c_001.main_46: Allocate memory for data before copying */
             datlen = cmStrlen(sctpNtfy->sn_remote_error.sre_data) + 1;
 
-            ret = SGetSBuf( meminfo->region, meminfo->pool, \
+            ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__, meminfo->region, meminfo->pool, \
                   &ntfy->u.remoteErr.data, datlen );
             if( ret != ROK )
             {
@@ -2792,7 +2782,7 @@ CmInetSctpNotification *ntfy        /* notification parameters */
             /* cm_inet_c_001.main_46: Allocate memory for data before copying */
             datlen = cmStrlen(sctpNtfy->sn_send_failed.ssf_data) + 1;
 
-            ret = SGetSBuf( meminfo->region, meminfo->pool, \
+            ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__, meminfo->region, meminfo->pool, \
                   &ntfy->u.sndFailed.data, datlen );
             if( ret != ROK )
             {
@@ -2850,7 +2840,7 @@ CmInetSctpNotification *ntfy        /* notification parameters */
       ret = SGetMsg(meminfo->region, meminfo->pool, mBuf);
       if (ret != ROK)
       {
-         SPutSBuf(meminfo->region, meminfo->pool, recvbuf, buflen);
+         SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,meminfo->region, meminfo->pool, recvbuf, buflen);
          return RFAILED;
       }
 
@@ -2858,13 +2848,13 @@ CmInetSctpNotification *ntfy        /* notification parameters */
       if (ret != ROK)
       {
          SPutMsg(*mBuf);
-         SPutSBuf(meminfo->region, meminfo->pool, recvbuf, buflen);
+         SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,meminfo->region, meminfo->pool, recvbuf, buflen);
          return RFAILED;
       }
    }
 
    /* cleanup */
-   SPutSBuf(meminfo->region, meminfo->pool, recvbuf, buflen);       
+   SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,meminfo->region, meminfo->pool, recvbuf, buflen);       
 
    return ROK;
 }
@@ -4010,48 +4000,48 @@ S16             flags           /* additional control flags, unused */
 )
 {
 #if (defined(WIN32) || defined(CMINETFLATBUF))
-   S32     ret;                 /* temporary return value */
-   MsgLen  msgLen;              /* message length */ 
-   MsgLen  bufLen;              /* send buffer length */
-   Data   *sendBuf;             /* plain send buffer */
-#else
-   S32 ret;                     /* temporary return value */
-   S32 retVal;                  /* temporary return value */
-   S16 i;                       /* loop index */
-   CmInetIovec  txArr[CM_INET_MAX_DBUF]; /* scatter vector */
-   S16      numDBufs;           /* number of dBufs in message */
-   struct   msghdr msg;         /* sendmsg() message header */
-   MsgLen   msgLen;             /* message length */ 
-   uint32_t      strtEndDBufNum;     /* starting/ending DBuf number */ 
-   MsgLen   unSentLen;          /* sent len */
+   S32     ret =0;                 /* temporary return value */
+   MsgLen  msgLen =0;              /* message length */ 
+   MsgLen  bufLen =0;              /* send buffer length */
+   Data   *sendBuf =0;             /* plain send buffer */
+#else
+   S32 ret =0;                     /* temporary return value */
+   S32 retVal =0;                  /* temporary return value */
+   S16 i =0;                       /* loop index */
+   CmInetIovec  txArr[CM_INET_MAX_DBUF] = {{0}}; /* scatter vector */
+   S16      numDBufs =0;           /* number of dBufs in message */
+   struct   msghdr msg ={0};         /* sendmsg() message header */
+   MsgLen   msgLen =0;             /* message length */ 
+   uint32_t      strtEndDBufNum =0;     /* starting/ending DBuf number */ 
+   MsgLen   unSentLen =0;          /* sent len */
 #ifdef IPV6_SUPPORTED 
-   uint32_t    curMsgIdx;            /* indx in cmsgData where to write an ext hdr */
+   uint32_t    curMsgIdx =0;            /* indx in cmsgData where to write an ext hdr */
    /* added for IPv6 ext hdr */
 #if (defined(SS_LINUX) || defined(_XPG4_2))
    /* alloc from stack for IPv6 ancill data */
-   uint8_t     cmsgData[CM_INET_IPV6_ANCIL_DATA];
+   uint8_t     cmsgData[CM_INET_IPV6_ANCIL_DATA]= {0};
 #endif /* SS_LINUX || _XPG4_2 */
 #else
-   uint32_t    curMsgIdx;            /* indx in cmsgData where to write an ext hdr */
+   uint32_t    curMsgIdx =0;            /* indx in cmsgData where to write an ext hdr */
 #if (defined(SS_LINUX) || defined(_XPG4_2))
    /* alloc from stack for IPv4 ancill data */ 
-    uint8_t     cmsgData[CM_INET_IPV4_ANCIL_DATA];
+    uint8_t     cmsgData[CM_INET_IPV4_ANCIL_DATA]={0};
 #endif /* SS_LINUX || _XPG4_2 */
 #endif /* IPV6_SUPPORTED */   
 #endif /* WIN32 | CMINETFLATBUF */  
 
-   struct  sockaddr_in remAddr; /* remote Internet address */   
+   struct  sockaddr_in remAddr ={0}; /* remote Internet address */   
 #ifdef IPV6_SUPPORTED
-   struct   sockaddr_in6  remAddr6; /* remote Internet address */   
+   struct   sockaddr_in6  remAddr6 = {0}; /* remote Internet address */   
 #endif /* IPV8_SUPPORTED */
-   CmInetSockAddr *sockAddrPtr;
+   CmInetSockAddr *sockAddrPtr = NULLP;
    /* cm_inet_c_001.main_58 : Fix for klockwork issue */
-   uint32_t            sizeOfAddr;    
+   uint32_t            sizeOfAddr =0;    
 
    /* cm_inet_c_001.main_50 - Added for partial send handling */
    /* cm_inet_c_001.main_59: Protected under if not defined WIN32*/
 #if (!defined(WIN32)) 
-   MsgLen         ioLen; 
+   MsgLen         ioLen =0
 #endif
 
 
@@ -4125,7 +4115,7 @@ S16             flags           /* additional control flags, unused */
    {
       return RFAILED;
    }
-   ret = SGetSBuf(info->region, info->pool, &sendBuf, bufLen);                  
+   ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, &sendBuf, bufLen);                  
    if (ret != ROK)
    {
       return (ROUTRES);
@@ -4134,7 +4124,7 @@ S16             flags           /* additional control flags, unused */
    if ((ret != ROK) || (msgLen != bufLen)) 
    {
       /* cleanup */
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);       
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);       
       return RFAILED;
    }
 
@@ -4167,7 +4157,7 @@ S16             flags           /* additional control flags, unused */
    if (ret == INET_ERR)
    {
       /* cleanup */
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);      
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);      
 
       if(INET_ERR_CODE == ERR_AGAIN)
       {
@@ -4224,12 +4214,12 @@ S16             flags           /* additional control flags, unused */
    if (ret < bufLen) 
    {   
       /* cleanup */
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);      
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);      
       return (RWOULDBLOCK);
    }
 
    /* cleanup */
-   SPutSBuf(info->region, info->pool, sendBuf, bufLen);      
+   SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);      
 
 #else /* end of Win NT/flat buffer specific part */
    ret = SFndLenMsg(mBuf, &msgLen);
@@ -4506,7 +4496,7 @@ S16             flags           /* additional control flags, unused */
    S32 ret;                     /* temporary return value */
    S32 retVal;                  /* temporary return value */
    S16 i;                       /* loop index */
-   CmInetIovec  txArr[CM_INET_MAX_DBUF]; /* scatter vector */
+   CmInetIovec  txArr[CM_INET_MAX_DBUF] ={{0}}; /* scatter vector */
    S16      numDBufs;           /* number of dBufs in message */
    struct   msghdr msg;         /* sendmsg() message header */
    MsgLen   msgLen;             /* message length */ 
@@ -4616,7 +4606,7 @@ S16             flags           /* additional control flags, unused */
    {
       return RFAILED;
    }
-   ret = SGetSBuf(info->region, info->pool, &sendBuf, bufLen);                  
+   ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, &sendBuf, bufLen);                  
    if (ret != ROK)
    {
       return (ROUTRES);
@@ -4625,7 +4615,7 @@ S16             flags           /* additional control flags, unused */
    if ((ret != ROK) || (msgLen != bufLen)) 
    {
       /* cleanup */
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);       
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);       
       return RFAILED;
    }
 
@@ -4658,7 +4648,7 @@ S16             flags           /* additional control flags, unused */
    if (ret == INET_ERR)
    {
       /* cleanup */
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);      
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);      
 
       if(INET_ERR_CODE == ERR_AGAIN)
       {
@@ -4715,12 +4705,12 @@ S16             flags           /* additional control flags, unused */
    if (ret < bufLen) 
    {   
       /* cleanup */
-      SPutSBuf(info->region, info->pool, sendBuf, bufLen);      
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);      
       return (RWOULDBLOCK);
    }
 
    /* cleanup */
-   SPutSBuf(info->region, info->pool, sendBuf, bufLen);      
+   SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, sendBuf, bufLen);      
 
 #else /* end of Win NT/flat buffer specific part */
    ret = SFndLenMsg(mBuf, &msgLen);
@@ -5392,7 +5382,7 @@ CmInetMemInfo   *info            /* Memory information */
    }
 
    /* allocate mem needed to hold all HBH/Dest options */
-   ret = SGetSBuf(info->region, info->pool, 
+   ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, 
          (Data **)&hbhOptsArr->hbhOpts, 
          (Size)((sizeof(CmInetIpv6HBHHdr)) * numOpts)); 
    if (ret != ROK)
@@ -5461,7 +5451,7 @@ CmInetMemInfo   *info            /* Memory information */
       {   
          /* take care of all other options having valid value field
           * such as Router Alert, PADN >= 3 bytes and Jumbo */
-         ret = SGetSBuf(info->region, info->pool, 
+         ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, 
                (Data **)&hbhOptsArr->hbhOpts[optsIdx].value, 
                (Size)hbhOptsArr->hbhOpts[optsIdx].length);
          if (ret != ROK)
@@ -5484,7 +5474,7 @@ CmInetMemInfo   *info            /* Memory information */
                   snprintf(prntBuf, CMINET_PRNT_BUF_SIZE, "SPutSBuf call 1 in BuildRecvHopOptsArr\n");
                   CMINETLOGERROR(ERRCLS_INT_PAR, ECMINET030, 0, prntBuf);
 #endif /* CMINETDBG */                  
-                  SPutSBuf(info->region, info->pool, 
+                  SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, 
                         (Data *)hbhOptsArr->hbhOpts[optsIdx - 1].value,
                         (Size)hbhOptsArr->hbhOpts[optsIdx - 1].length);
                }
@@ -5498,7 +5488,7 @@ CmInetMemInfo   *info            /* Memory information */
             snprintf(prntBuf, CMINET_PRNT_BUF_SIZE, "SPutSBuf call 2 in BuildRecvHopOptsArr\n");
             CMINETLOGERROR(ERRCLS_DEBUG, ECMINET031, 0, prntBuf);
 #endif /* CMINETDBG */            
-            SPutSBuf(info->region, info->pool, 
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, 
                   (Data *)hbhOptsArr->hbhOpts, numOpts * sizeof(CmInetIpv6HBHHdr));
             hbhOptsArr->numHBHOpts = 0;
             hbhOptsArr->hbhOpts = NULLP;
@@ -5581,7 +5571,7 @@ CmInetMemInfo   *info      /* Memory information */
    /* subtract 8 bytes for Next Hdr, Hdr Ext Len, .... + SL bit map */
    rtOptsArr->numAddrs = (rtDataLen - 8)/16;
 
-   ret = SGetSBuf(info->region, info->pool, 
+   ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, 
          (Data **)&rtOptsArr->ipv6Addrs, 
          (Size)rtOptsArr->numAddrs * 16);
    if (ret != ROK)
@@ -5700,51 +5690,51 @@ S32              flags          /* additional control flags */
 )
 {
 #if (defined(WIN32) || defined(CMINETFLATBUF))
-   S32           ret;            /* temporary return value */
-   uint32_t           pendLen;        /* pending data length */
-   S32           recvLen;        /* number of received octets by recvmsg() */
-   MsgLen        bufLen;         /* entire number of received octets */
-   MsgLen        curLen;         /* current number of octets in buffer */ 
-   Data         *recvBuf;        /* receive buffer */
-   Data         *bufPtr;         /* current buffer position */   
-   Buffer       *mBuf;           /* received message */ 
-   uint32_t           remAddrLen;     /* length of remote address */
-   struct sockaddr_in  *remAddr;    /* remote Internet address */       
+   S32          ret = 0;            /* temporary return value */
+   uint32_t     pendLen =0;        /* pending data length */
+   S32          recvLen =0;        /* number of received octets by recvmsg() */
+   MsgLen       bufLen =0;         /* entire number of received octets */
+   MsgLen       curLen =0;         /* current number of octets in buffer */ 
+   Data         *recvBuf =NULLP;        /* receive buffer */
+   Data         *bufPtr =NULLP;         /* current buffer position */   
+   Buffer       *mBuf = NULLP;           /* received message */ 
+   uint32_t     remAddrLen =0;     /* length of remote address */
+   struct sockaddr_in  *remAddr = {0};    /* remote Internet address */       
 #ifdef IPV6_SUPPORTED 
-   struct sockaddr_in6  *remAddr6;  /* remote Internet address */       
-   struct sockaddr_in6 remSockAddr; /* to get packet's source IP address */
+   struct sockaddr_in6  *remAddr6 = {0};  /* remote Internet address */       
+   struct sockaddr_in6 remSockAddr ={0}; /* to get packet's source IP address */
 #else
-   CmInetSockAddr  remSockAddr;     /* to get packet's source IP address */
+   CmInetSockAddr  remSockAddr ={0};     /* to get packet's source IP address */
 #endif /* IPV6_SUPPORTED */
 #else
-   S32           ret;            /* temporary return value */
+   S32           ret =0;            /* temporary return value */
   /* cm_inet_c_001.main_58: Fix for g++ compilation warning */
-   uint16_t           i;              /* index */
-   uint32_t           pendLen;        /* pending data length */
-   S32           numBuf;         /* number of allocated dBufs */
-   S32           recvLen;        /* number of received octets by recvmsg() */
-   MsgLen        bufLen;         /* entire number of received octets */
-   struct msghdr msg;            /* message header */ 
+   uint16_t      i =0;              /* index */
+   uint32_t      pendLen =0;        /* pending data length */
+   S32           numBuf =0;         /* number of allocated dBufs */
+   S32           recvLen =0;        /* number of received octets by recvmsg() */
+   MsgLen        bufLen =0;         /* entire number of received octets */
+   struct msghdr msg = {0};            /* message header */ 
    /* cm_inet_c_001.main_54: Fix for Klockworks issue */
    Buffer       *tempMsg = NULLP;        /* temporary message */
-   CmInetIovec  rxArr[CM_INET_MAX_DBUF]; /* dynamic gather array */
+   CmInetIovec  rxArr[CM_INET_MAX_DBUF]= {{0}};  /* dynamic gather array */
    Buffer      **dBufs = NULLP;   /* dynamic array with allocated dBufs */
-   S16           numDBufs;       /* number of allocated dBufs */
+   S16           numDBufs =0;       /* number of allocated dBufs */
 
    /* cm_inet_c_001.main_55: As remAddrLen is only being used when
     * WIN32 or CMINETFLATBUF is defined, then Removed variable
     * in else part*/
-   struct sockaddr_in *remAddr;  /* remote Internet address */       
+   struct sockaddr_in *remAddr = {0};  /* remote Internet address */       
 #ifdef IPV6_SUPPORTED 
-   struct sockaddr_in6 *remAddr6;  /* remote Internet address */       
-   struct sockaddr_in6 remSockAddr;/* to get packet's source IP address */
+   struct sockaddr_in6 *remAddr6 ={0};  /* remote Internet address */       
+   struct sockaddr_in6 remSockAddr ={0};/* to get packet's source IP address */
    /* added for IPv6 ext headers support */
 #ifdef IPV6_OPTS_SUPPORTED
-   CmInetIpv6RtHdr0     rtHdr0;          /* type 0 route header */      
+   CmInetIpv6RtHdr0     rtHdr0 ={0};          /* type 0 route header */      
 #endif /* IPV6_OPTS_SUPPORTED */
 
 #ifdef LOCAL_INTF
-   struct in6_pktinfo  *pkt6Info;        /* IPv6 IP_PKTINFO */
+   struct in6_pktinfo  *pkt6Info = {0};        /* IPv6 IP_PKTINFO */
 #endif /* LOCAL_INTF */   
 
 #if (defined(SS_LINUX) || defined(_XPG4_2))
@@ -5752,7 +5742,7 @@ S32              flags          /* additional control flags */
    /* from stack for IPv6 ancill data */
 #endif
 #else
-   CmInetSockAddr       remSockAddr;     /* to get packet's src IP address */
+   CmInetSockAddr       remSockAddr ={0};     /* to get packet's src IP address */
 #if (defined(SS_LINUX) || defined(_XPG4_2))
    uint8_t                   ancillData[CM_INET_IPV4_ANCIL_DATA];
    /* from stack for IPv4 ancill data */
@@ -5936,7 +5926,7 @@ S32              flags          /* additional control flags */
       }
 
       /* allocate flat receive buffer */
-      ret = SGetSBuf(info->region, info->pool, &recvBuf, bufLen);
+      ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, &recvBuf, bufLen);
       if (ret != ROK)
       {
          return (ROUTRES);
@@ -5984,7 +5974,7 @@ S32              flags          /* additional control flags */
          {
             /* cleanup */
             /* moved cleanup here */
-            SPutSBuf(info->region, info->pool, recvBuf, bufLen); 
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen); 
 
             /*  added check ERR_WOULDBLOCK */
             if ((INET_ERR_CODE == ERR_AGAIN) ||
@@ -6055,7 +6045,7 @@ S32              flags          /* additional control flags */
          if ((sockFd->type == CM_INET_DGRAM) && (*len == 0))
 #endif
          {
-            SPutSBuf(info->region, info->pool, recvBuf, bufLen);
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);
             return (ROKDNA);
          }
 
@@ -6087,7 +6077,7 @@ S32              flags          /* additional control flags */
             CMINETLOGERROR(ERRCLS_INT_PAR, ECMINET068, 0, prntBuf);
 #endif /*ALIGN_64BIT*/
 #endif
-            SPutSBuf(info->region, info->pool, recvBuf, bufLen);
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);
             return (ROKDNA);
          }
 
@@ -6096,7 +6086,7 @@ S32              flags          /* additional control flags */
       if (ret != ROK)
       {
          /* cleanup */
-         SPutSBuf(info->region, info->pool, recvBuf, bufLen);       
+         SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);       
          return (ret);
       }
 
@@ -6124,7 +6114,7 @@ S32              flags          /* additional control flags */
 
       if (ret != ROK)
       {
-         SPutSBuf(info->region, info->pool, recvBuf, bufLen);    
+         SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);    
          SPutMsg(mBuf); 
          return (ret);
       }
@@ -6158,7 +6148,7 @@ S32              flags          /* additional control flags */
       }   
 
       /* cleanup */
-      SPutSBuf(info->region, info->pool, recvBuf, bufLen);      
+      SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);      
 
 #else  /* end of Win NT/flat buffer specific part */
 
@@ -6174,7 +6164,7 @@ S32              flags          /* additional control flags */
          /* allocate gather vector, it's a dynamic array */    
          numDBufs =  CM_INET_MAX_DBUF;
 
-         ret = SGetSBuf(info->region, info->pool, (Data**)&dBufs, 
+         ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, (Data**)&dBufs, 
                numDBufs*sizeof(Buffer*));
          if (ret != ROK)
          {
@@ -6210,11 +6200,11 @@ S32              flags          /* additional control flags */
                   for (i = 0; i < msg.msg_iovlen; i++)
                      SPutDBuf(info->region, info->pool, dBufs[i]);   
 
-                  SPutSBuf(info->region, info->pool, (Data*)dBufs, 
+                  SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, (Data*)dBufs, 
                         numDBufs * sizeof(Buffer*)); 
 
                   /* allocate flat receive buffer */
-                  ret = SGetSBuf(info->region, info->pool, &recvBuf, bufLen);
+                  ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, &recvBuf, bufLen);
                   if (ret != ROK)
                      return (ROUTRES);
 
@@ -6234,7 +6224,7 @@ S32              flags          /* additional control flags */
             }
             else
             {
-               SPutSBuf(info->region, info->pool, (Data*)dBufs, 
+               SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, (Data*)dBufs, 
                      numDBufs*sizeof(Buffer*)); 
                return (ret);
             }
@@ -6278,7 +6268,7 @@ S32              flags          /* additional control flags */
             /* Moved up the cleanup precedures here before returning */
             /* Cleanup flat buffer if allocated */
             if (allocFlatBuf)
-               SPutSBuf(info->region, info->pool, recvBuf, bufLen);
+               SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);
             else
             {
                /* cleanup */
@@ -6291,7 +6281,7 @@ S32              flags          /* additional control flags */
 
                   SPutDBuf(info->region, info->pool, dBufs[i]);   
                }
-               SPutSBuf(info->region, info->pool, (Data*)dBufs, 
+               SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, (Data*)dBufs, 
                      numDBufs*sizeof(Buffer*)); 
             }
 
@@ -6519,7 +6509,7 @@ S32              flags          /* additional control flags */
             if (ret != ROK)
             {
                /* cleanup */
-               SPutSBuf(info->region, info->pool, recvBuf, bufLen);       
+               SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);       
                return (ret);
             }
 
@@ -6529,7 +6519,7 @@ S32              flags          /* additional control flags */
                ret = SAddPstMsgMult(recvBuf, recvLen, tempMsg);        
                if (ret != ROK)
                {
-                  SPutSBuf(info->region, info->pool, recvBuf, bufLen);    
+                  SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);    
                   SPutMsg(tempMsg); 
                   return (ret);
                }
@@ -6537,7 +6527,7 @@ S32              flags          /* additional control flags */
 
             *mPtr = tempMsg;
 
-            SPutSBuf(info->region, info->pool, recvBuf, bufLen);    
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);    
             /* cm_inet_c_001.main_48 :flat buffers are allocated 
              * for non -TCP sockets. On these sockets we can receive 
              * only one message at a time 
@@ -6556,7 +6546,7 @@ S32              flags          /* additional control flags */
                 * mBuf */
                if (*mPtr != NULLP)
                   SPutMsg(*mPtr);
-               SPutSBuf(info->region, info->pool, (Data*)dBufs, 
+               SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, (Data*)dBufs, 
                      numDBufs*sizeof(Buffer*)); 
                return (ret);
             }
@@ -6576,14 +6566,14 @@ S32              flags          /* additional control flags */
                /* cleanup */
                SPutMsg(*mPtr);
                SPutMsg(tempMsg);
-               SPutSBuf(info->region, info->pool, (Data*)dBufs, 
+               SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, (Data*)dBufs, 
                      numDBufs*sizeof(Buffer*)); 
                return RFAILED;
             }
             SPutMsg(tempMsg);
          }
 
-         SPutSBuf(info->region, info->pool, (Data*)dBufs, 
+         SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, (Data*)dBufs, 
                numDBufs*sizeof(Buffer*)); 
 
          /* 
@@ -7013,7 +7003,7 @@ Data            *data           /* read data */
       if ((MsgLen)pendLen >= bufLen)
       {        
          /* allocate receive buffer (flat structure) */
-         ret = SGetSBuf(info->region, info->pool, &recvBuf, bufLen);                  
+         ret = SGetSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, &recvBuf, bufLen);                  
          if (ret != ROK)
          {
             return (ROUTRES);
@@ -7054,7 +7044,7 @@ Data            *data           /* read data */
          {
             /* cleanup */
             /* moved cleanup here */
-            SPutSBuf(info->region, info->pool, recvBuf, bufLen); 
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen); 
 
             /* added check ERR_WOULDBLOCK */
             if ((INET_ERR_CODE == ERR_AGAIN) ||
@@ -7093,7 +7083,7 @@ Data            *data           /* read data */
          if (recvLen < (S32)bufLen)  /* maybe happen */
          {
             /* cleanup */
-            SPutSBuf(info->region, info->pool, recvBuf, bufLen);                            
+            SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);                            
             return (ROKDNA);
          } 
 
@@ -7132,7 +7122,7 @@ Data            *data           /* read data */
          }   
 
          /* cleanup */
-         SPutSBuf(info->region, info->pool, recvBuf, bufLen);                            
+         SPutSBufNewForDebug(__FILE__,__FUNCTION__,__LINE__,info->region, info->pool, recvBuf, bufLen);                            
       }
       else
       {