hrev43456 adds 1 changeset to branch 'master' old head: d0aa07489c022f98519a79cbd5ceea5ac060d4d6 new head: 9a87646122bb87e350f8c1886d47db0d466c0868 ---------------------------------------------------------------------------- 9a87646: Only free the old buffer if we owned it and set owning flag. * If we cloned the buffer due to misalignment, only free the old buffer if we actually own it (i.e. if it was allocated by us). * Set the KMESSAGE_OWNS_BUFFER flag after cloning the buffer. Previously the buffer was leaked in the clone case. [ Michael Lotz <mmlr@xxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev43456 Commit: 9a87646122bb87e350f8c1886d47db0d466c0868 URL: http://cgit.haiku-os.org/haiku/commit/?id=9a87646 Author: Michael Lotz <mmlr@xxxxxxxx> Date: Sat Dec 10 17:46:29 2011 UTC ---------------------------------------------------------------------------- 1 files changed, 2 insertions(+), 1 deletions(-) src/system/kernel/messaging/KMessage.cpp | 3 ++- ---------------------------------------------------------------------------- diff --git a/src/system/kernel/messaging/KMessage.cpp b/src/system/kernel/messaging/KMessage.cpp index e6b5800..d4dbf03 100644 --- a/src/system/kernel/messaging/KMessage.cpp +++ b/src/system/kernel/messaging/KMessage.cpp @@ -836,11 +836,12 @@ KMessage::_InitFromBuffer(bool sizeFromBuffer) memcpy(buffer, fBuffer, fBufferCapacity); - if ((fFlags & KMESSAGE_CLONE_BUFFER) == 0) + if ((fFlags & KMESSAGE_OWNS_BUFFER) != 0) free(fBuffer); fBuffer = buffer; fFlags &= ~(uint32)(KMESSAGE_READ_ONLY | KMESSAGE_CLONE_BUFFER); + fFlags |= KMESSAGE_OWNS_BUFFER; } if (_Align(fBuffer) != fBuffer)