From 579e19f5b954c0ef288404f3c071a3e0fc9f7ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 17 Aug 2010 15:21:39 +0000 Subject: [PATCH] * Fixed CID 1703: buffer could be leaked. Thanks to Stefano for the note. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38191 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 053ee6b429..bac15edd38 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -582,8 +582,10 @@ BlockAllocator::InitializeAndClearBitmap(Transaction& transaction) for (int32 i = 0; i < fNumGroups; i++) { if (write_pos(fVolume->Device(), offset << blockShift, buffer, - fBlocksPerGroup << blockShift) < B_OK) + fBlocksPerGroup << blockShift) < B_OK) { + free(buffer); return B_ERROR; + } // the last allocation group may contain less blocks than the others if (i == fNumGroups - 1) {