Fix prevent defects
authorhb.min <hb.min@samsung.com>
Tue, 9 Apr 2013 15:12:14 +0000 (00:12 +0900)
committerhb.min <hb.min@samsung.com>
Tue, 9 Apr 2013 15:12:14 +0000 (00:12 +0900)
Change-Id: If101a133bc5a396f927c9c4f7422f93bd4abee07
Signed-off-by: hb.min <hb.min@samsung.com>
src/security/FSec_PrivacyManagerImpl.cpp
src/security/FSec_PrivilegeInfo.cpp

index e5b437a..7944b4e 100755 (executable)
@@ -103,7 +103,7 @@ _PrivacyManagerImpl::GetPrivacyInfoListN(const Tizen::App::PackageId& packageId)
        pAppId = _StringConverter::CopyToCharArrayN(packageId);
 
        ret = privacy_manager_client_foreach_get_privacy_info(pAppId, GetPrivacyInfoListNCallback, (void *)pPrivacyIdList);
-       delete pAppId;
+       delete[] pAppId;
 
        return pPrivacyIdList;
 }
@@ -123,6 +123,9 @@ _PrivacyManagerImpl::SetAppPackagePrivacy(const Tizen::App::PackageId& packageId
        isEnabled = privacyInfo.IsEnabled();
 
        ret = privacy_manager_client_set_package_privacy(pPackageId, pPrivacyId, isEnabled);
+
+       delete[] pPackageId;
+       delete[] pPrivacyId;
        return r;
 }
 
index 24868c1..24276dc 100644 (file)
@@ -257,10 +257,10 @@ _PrivilegeInfo::CloneN(void) const
 
        std::unique_ptr<IEnumerator> pEnum(null);
        r = pPrivilegeInfo->__privilegeList.Construct();
-       SysTryReturn(NID_SEC, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        pEnum.reset(this->__privilegeList.GetEnumeratorN());
-       SysTryReturn(NID_SEC, pEnum != null, null, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        while (pEnum->MoveNext() == E_SUCCESS)
        {
@@ -269,6 +269,13 @@ _PrivilegeInfo::CloneN(void) const
        }
 
        return pPrivilegeInfo;
+
+CATCH:
+
+       SetLastResult(r);
+
+       delete pPrivilegeInfo;
+       return null;
 }
 
 result