From 6de4b3532c4b9ed084cb1bb51da9277e94e0c9d0 Mon Sep 17 00:00:00 2001 From: ccli8 Date: Mon, 2 Jul 2018 11:29:29 +0800 Subject: [PATCH] Fix memory leakage with MBR on exiting error path --- features/filesystem/bd/MBRBlockDevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/features/filesystem/bd/MBRBlockDevice.cpp b/features/filesystem/bd/MBRBlockDevice.cpp index e83e4fbf07..bcea66f69b 100644 --- a/features/filesystem/bd/MBRBlockDevice.cpp +++ b/features/filesystem/bd/MBRBlockDevice.cpp @@ -242,6 +242,7 @@ int MBRBlockDevice::init() // Check that block addresses are valid if (!_bd->is_valid_erase(_offset, _size)) { + delete[] buffer; return BD_ERROR_INVALID_PARTITION; }