From a8ee07607fb94578fed090672b0d35ff6ba682eb Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Mon, 22 Apr 2013 22:59:10 +0900 Subject: [PATCH] Fixed memory leak Change-Id: I34b88abe58a8db6ce418b3fce90c2da8e1762223 Signed-off-by: Hosang Kim --- src/FScl_CalendarbookUtil.cpp | 4 +++- src/FScl_RecurrenceImpl.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/FScl_CalendarbookUtil.cpp b/src/FScl_CalendarbookUtil.cpp index 8f9d61a..f50361e 100644 --- a/src/FScl_CalendarbookUtil.cpp +++ b/src/FScl_CalendarbookUtil.cpp @@ -174,8 +174,10 @@ _CalendarbookUtil::ConvertCharArrayToByteBufferN(const char* pCharArray) result r = E_SUCCESS; std::unique_ptr pByteBuffer(new (std::nothrow) ByteBuffer()); SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - r = pByteBuffer->Construct(pByteArray.release(), 0, byteBufferLength, byteBufferLength); + r = pByteBuffer->Construct(byteBufferLength); SysTryReturn(NID_SCL, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + r = pByteBuffer->SetArray(pByteArray.get(), 0, byteBufferLength); + pByteBuffer->Rewind(); return pByteBuffer.release(); } diff --git a/src/FScl_RecurrenceImpl.cpp b/src/FScl_RecurrenceImpl.cpp index 9ba9a41..bcbd9ba 100644 --- a/src/FScl_RecurrenceImpl.cpp +++ b/src/FScl_RecurrenceImpl.cpp @@ -263,7 +263,7 @@ _RecurrenceImpl::SetFrequency(RecurFrequency type) // reset all properties if (__pUntil != null) { - __pUntil.release(); + __pUntil.reset(); } __dayOfWeek = 0; @@ -315,7 +315,7 @@ _RecurrenceImpl::SetUntil(const DateTime* pUntil) } else { - __pUntil.release(); + __pUntil.reset(); __count = _DEFAULT_COUNT; } -- 2.7.4