Merge "Revert "Fix prevent defect for locales"" into tizen_2.2
[platform/framework/native/appfw.git] / src / security / FSec_PrivilegeInfo.cpp
index 53e6fac..48b125b 100644 (file)
@@ -98,6 +98,10 @@ _PrivilegeInfo::Construct(const AppId& appId, const byte* pBitwisePrivilege, con
                SysTryReturnResult(NID_SEC, ret == PRVMGR_ERR_NONE, E_SYSTEM, "An unexpected system error occurred.");
 
                __privilegeList.Add((new String(*pTempString)), (new String(pPrivilegeLevel)));
+               if (pPrivilegeLevel != null)
+               {
+                       free(pPrivilegeLevel);
+               }
        }
 
        return r;
@@ -165,6 +169,10 @@ _PrivilegeInfo::Construct(const AppId& appId, const String& encryptedPrivileges,
                SysTryReturnResult(NID_SEC, ret == PRVMGR_ERR_NONE, E_SYSTEM, "An unexpected system error occurred.");
 
                __privilegeList.Add((new String(*pTempString)), (new String(pPrivilegeLevel)));
+               if (pPrivilegeLevel != null)
+               {
+                       free(pPrivilegeLevel);
+               }
        }
 
        return r;
@@ -265,6 +273,10 @@ _PrivilegeInfo::Construct(const AppId& appId, const String& encryptedPrivileges,
                SysTryReturnResult(NID_SEC, ret == PRVMGR_ERR_NONE, E_SYSTEM, "An unexpected system error occurred.");
 
                __privilegeList.Add((new String(*pTempString)), (new String(pPrivilegeLevel)));
+               if (pPrivilegeLevel != null)
+               {
+                       free(pPrivilegeLevel);
+               }
        }
 
        return r;
@@ -593,7 +605,7 @@ _PrivilegeInfo::VerifyIntegrity(const AppId& appId, const byte* targetBitwisePri
        ByteBuffer input;
        std::unique_ptr<IHash> pHash(null);
        std::unique_ptr<ByteBuffer> pChecksumByteBuffer(null);
-       std::unique_ptr<char> pAppId(null);
+       std::unique_ptr<char[]> pAppId(null);
 
        SysTryReturnResult(NID_SEC, length <= MAX_BITWISE_PRIV_SIZE, E_INVALID_ARG, "The privilege information of %ls is invalid.", appId.GetPointer());