libril: Fix freeing of strings for roaming protocol flag
authorPaul Keith <javelinanddart@gmail.com>
Thu, 28 Jun 2018 16:45:29 +0000 (18:45 +0200)
committerSimon Shields <simon@lineageos.org>
Sun, 1 Jul 2018 14:08:04 +0000 (16:08 +0200)
Change-Id: Id6150885203a64733bffeb7ce6dc4e91fab305df

ril/libril/ril_service.cpp

index 37bd2a6fc30d48d623ffb8b75d420edb315abd40..acad18d8b2285eaff8475c5a4bc3425222f4246c 100644 (file)
@@ -1943,7 +1943,7 @@ Return<void> RadioImpl::setInitialAttachApn(int32_t serial, const DataProfileInf
 
 #ifdef NEEDS_ROAMING_PROTOCOL_FIELD
         if (!copyHidlStringToRil(&iaa.roamingProtocol, dataProfileInfo.roamingProtocol, pRI)) {
-            memsetAndFreeStrings(4, iaa.apn, iaa.protocol, iaa.username, iaa.roamingProtocol);
+            memsetAndFreeStrings(4, iaa.apn, iaa.protocol, iaa.username, iaa.password);
             return Void();
         }
 #endif
@@ -1954,7 +1954,12 @@ Return<void> RadioImpl::setInitialAttachApn(int32_t serial, const DataProfileInf
 
         CALL_ONREQUEST(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI, mSlotId);
 
+#ifdef NEEDS_ROAMING_PROTOCOL_FIELD
+        memsetAndFreeStrings(5, iaa.apn, iaa.protocol, iaa.username, iaa.password,
+                iaa.roamingProtocol);
+#else
         memsetAndFreeStrings(4, iaa.apn, iaa.protocol, iaa.username, iaa.password);
+#endif
     } else {
         RIL_InitialAttachApn_v15 iaa = {};