wlan: Fix Static analysis error.

Fix Static analysis errors as below:
1) Handle return value in WLANDXE_StartLogTransfer and
   WDTS_openTransport
2) Removed dead code in wlan_hdd_cfg80211_set_ie
3) Limit check for rateIdx in hdd_mon_add_rx_radiotap_hdr
4) Null check for pHddCtx in hdd_rx_packet_monitor_cbk
5) Memory leak in __iw_setint_getnone,
   limHandleDelBssInReAssocContext and __limProcessSmeScanReq

Change-Id: I9dc0c630d62c06fb55e953f9506b04dbeff9bd51
CRs-Fixed: 919502
diff --git a/CORE/DXE/src/wlan_qct_dxe.c b/CORE/DXE/src/wlan_qct_dxe.c
index 4bacd95..35934e2 100644
--- a/CORE/DXE/src/wlan_qct_dxe.c
+++ b/CORE/DXE/src/wlan_qct_dxe.c
@@ -5750,7 +5750,7 @@
       return status;
    }
 
-   wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
+   status = wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
                           channelEntry->extraConfig.chan_mask);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index ce623e5..ab96977 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -13610,15 +13610,6 @@
                                 "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM");
                        }
                    }
-                   else
-                   {
-                      // Reset WNI_CFG_PROBE_RSP Flags
-                      wlan_hdd_reset_prob_rspies(pAdapter);
-
-                      hddLog(VOS_TRACE_LEVEL_INFO,
-                            "%s: No Probe Response IE received in set beacon",
-                            __func__);
-                   }
                 } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */
                 break;
             case DOT11F_EID_RSN:
diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c
index 3ba8640..06730d5 100644
--- a/CORE/HDD/src/wlan_hdd_tx_rx.c
+++ b/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -2347,6 +2347,12 @@
        rateIdx-=202;
     if( rateIdx >= 218 && rateIdx <= 225 )
        rateIdx-=210;
+
+    if(rateIdx > (sizeof(gRatefromIdx)/ sizeof(int))) {
+       VOS_TRACE( VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+                  "%s: invalid rateIdx %d make it 0", __func__, rateIdx);
+       rateIdx = 0;
+    }
     currentRSSI0 = WDA_GETRSSI0(pRxPacket) - 100;
     currentRSSI1 = WDA_GETRSSI1(pRxPacket) - 100;
     currentRSSI  = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
@@ -2411,6 +2417,15 @@
    }
 
    pHddCtx = (hdd_context_t *)vos_get_context( VOS_MODULE_ID_HDD, vosContext );
+
+   if (NULL == pHddCtx)
+   {
+      VOS_TRACE(VOS_MODULE_ID_HDD_DATA, VOS_TRACE_LEVEL_ERROR,
+                 FL("Failed to get pHddCtx from vosContext"));
+      vos_pkt_return_packet( pVosPacket );
+      return VOS_STATUS_E_FAILURE;
+   }
+
    pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_MONITOR);
    if ((NULL == pAdapter)  || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) )
    {
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 056e1c9..31a402b 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -5367,15 +5367,17 @@
     {
         return ret;
     }
+
+    hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
+    if (NULL == hHal)
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                 "%s: Hal Context is NULL",__func__);
+        return -EINVAL;
+    }
+
     if ( VOS_MONITOR_MODE != hdd_get_conparam())
     {
-      hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
-      if (NULL == hHal)
-      {
-          VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                    "%s: Hal Context is NULL",__func__);
-          return -EINVAL;
-      }
       pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
       if (NULL == pWextState)
       {
@@ -6101,7 +6103,8 @@
           {
               hddLog(VOS_TRACE_LEVEL_ERROR,
                       "%s: vos_mem_alloc failed", __func__);
-              return -ENOMEM;
+              ret = -ENOMEM;
+              break;
           }
 
           memset(pkt, 0, sizeof(tSirpkt80211));
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
index c38122b..2ff3ffd 100644
--- a/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
@@ -4781,6 +4781,7 @@
                 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
                 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
                 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
+                vos_mem_vfree(pBeaconStruct);
                 goto Error;
             }
             /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
diff --git a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
index 09b0baa..209a837 100644
--- a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
@@ -1408,6 +1408,7 @@
                                         pScanReq->sessionId,
                                         pScanReq->transactionId);
                   }
+                  vos_mem_free(pMlmScanReq);
                   return;
               }
               pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
diff --git a/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c b/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
index 13b2d59..ccc0eff 100644
--- a/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
+++ b/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
@@ -1030,7 +1030,7 @@
 
   wpalMemoryZero(&gDsTrafficStats, sizeof(gDsTrafficStats));
 
-  WDI_DS_LoggingMbCreate(&pClientData->loggingMbContext, sizeof(tLoggingMailBox));
+  sWdiStatus = WDI_DS_LoggingMbCreate(&pClientData->loggingMbContext, sizeof(tLoggingMailBox));
   if (WDI_STATUS_SUCCESS != sWdiStatus)
     return eWLAN_PAL_STATUS_E_NOMEM;