Fixed memory leak in RsaConvertKey function.
authorvarinder.p <varinder.p@samsung.com>
Fri, 25 Oct 2013 04:31:18 +0000 (13:31 +0900)
committervarinder.p <varinder.p@samsung.com>
Fri, 25 Oct 2013 04:42:46 +0000 (13:42 +0900)
Signed-off-by: varinder.p <varinder.p@samsung.com>
Change-Id: I2f46129780a5a7da81b63930e8f2c0d448049a05

src/security/FSecRsaKeyConverter.cpp

index b8f9bff..84107e0 100644 (file)
@@ -248,10 +248,9 @@ RsaKeyConverter::ConvertPublicKeyFormatN(RsaKeyFormat format, const IPublicKey&
        if (isPemFormat == true)
        {
                PublicKey nKey;
-               r = nKey.SetKey(*pOutBuffer);
+               r = nKey.SetKey(*pOutBuffer.get());
                SysTryCatch(NID_SEC, !IsFailed(r), r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The specified input parameter is invalid.");
-               pOutBuffer.reset(ConvertDerToPemN(format, nKey));
-               //pOutBuffer = std::unique_ptr< ByteBuffer >(ConvertDerToPemN(format, nKey));
+               pOutBuffer = std::unique_ptr< ByteBuffer >(ConvertDerToPemN(format, nKey));
                SysTryCatch(NID_SEC, pOutBuffer != null, r = GetLastResult(), GetLastResult(), "[%s] Failed to convert der to pem encoded byte buffer");
        }