[APR-1563] wlbt: Prevent issues in APF in wifi_hal

Code changes to fix prevent issues in wifi_hal in APF.

SCSC-Bug-Id: HOST-10738
Signed-off-by: Srishti Piplani <srishti.p@samsung.com>
Change-Id: I93703d9437f15d9dcc3772e3ff007811b3b9914f
diff --git a/wifi_hal.cpp b/wifi_hal.cpp
index 6e0ab1c..8e5d4dc 100755
--- a/wifi_hal.cpp
+++ b/wifi_hal.cpp
@@ -90,10 +90,10 @@
         const u8* mProgram;
         u32 mProgramLen;
         u32* mVersion;
-        u32* mMaxLen;
+        u32* mMaxLen = 0;
         u32 mSourceOffset;
         u8 *mHostDestination;
-        u32 mLength;
+        u32 mLength = 0;
         int mReqType;
     public:
         AndroidPktFilterCommand(wifi_interface_handle handle,
@@ -139,23 +139,24 @@
 
     int createSetPktFilterRequest(WifiRequest& request) {
         u8 *program = new u8[mProgramLen];
+        nlattr *data = NULL;
         NULL_CHECK_RETURN(program, "memory allocation failure", WIFI_ERROR_OUT_OF_MEMORY);
         int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_APF_SET_FILTER);
-        if (result < 0) {
-            return result;
-        }
+        if (result < 0)
+            goto exit;
 
-        nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
+        data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
         result = request.put_u32(APF_ATTRIBUTE_PROGRAM_LEN, mProgramLen);
-        if (result < 0) {
-            return result;
-        }
+        if (result < 0)
+            goto exit;
+
         memcpy(program, mProgram, mProgramLen);
         result = request.put(APF_ATTRIBUTE_PROGRAM, program, mProgramLen);
-        if (result < 0) {
-            return result;
-        }
+        if (result < 0)
+            goto exit;
         request.attr_end(data);
+
+exit:
         delete[] program;
         return result;
     }