Fix prevent issues: #50710, #50711
authorso.yu <so.yu@samsung.com>
Thu, 11 Apr 2013 02:36:26 +0000 (11:36 +0900)
committerso.yu <so.yu@samsung.com>
Thu, 11 Apr 2013 02:36:53 +0000 (11:36 +0900)
Change-Id: Ia1e31cefff9bf9d722cd84ec8634cdaa7798579f
Signed-off-by: so.yu <so.yu@samsung.com>
src/security/FSec_DeviceKeyGenerator.cpp

index fdee420..42adbc0 100644 (file)
@@ -89,7 +89,6 @@ _DeviceKeyGenerator::GenerateDeviceKeyN(int keySize)
        r = deviceInfoBuffer.SetArray(reinterpret_cast <byte*>(pDeviceInfo), 0, deviceInfo.GetLength());
        SysTryCatch(NID_SEC, r == E_SUCCESS, , r, "[%s] A system error has occurred.", GetErrorMessage(r));
        deviceInfoBuffer.Flip();
-       delete[] pDeviceInfo;
 
        for (int i = 0; i < count; i++)
        {
@@ -123,6 +122,7 @@ _DeviceKeyGenerator::GenerateDeviceKeyN(int keySize)
 
 CATCH:
        SetLastResult(r);
+       delete[] pDeviceInfo;
        delete pTempInfoBuffer;
 
        return pKey.release();
@@ -172,7 +172,6 @@ _DeviceKeyGenerator::GenerateDeviceKeyN(String& appId, int keySize)
        r = deviceInfoBuffer.SetArray(reinterpret_cast <byte*>(pDeviceInfo), 0, deviceInfo.GetLength());
        SysTryCatch(NID_SEC, r == E_SUCCESS, , r, "[%s] A system error has occurred.", GetErrorMessage(r));
        deviceInfoBuffer.Flip();
-       delete[] pDeviceInfo;
 
        pHmacKey.reset(StringUtil::StringToUtf8N(appId));
 
@@ -213,6 +212,7 @@ _DeviceKeyGenerator::GenerateDeviceKeyN(String& appId, int keySize)
 
 CATCH:
        SetLastResult(r);
+       delete[] pDeviceInfo;
        delete pTempInfoBuffer;
 
        return pKey.release();