mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(test_apps_bootloader): Pre-alocate the security provider lock before evaluating mem leaks
This commit is contained in:
committed by
Konstantin Kondrashov
parent
b4dd9878f7
commit
40f25003b4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_runner.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_crypto_lock.h"
|
||||
|
||||
// There should be no memory allocated during the test.
|
||||
#define TEST_MEMORY_INITIAL_LEAK_THRESHOLD (-700)
|
||||
@@ -26,7 +27,14 @@ static void check_leak(size_t before_free, size_t after_free, const char *type)
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
// load the partition table before measuring the initial free heap size.
|
||||
/* Lazy-init crypto locks (FreeRTOS mutexes) before measuring free heap.
|
||||
* First HMAC use otherwise allocates ~248 bytes and trips the leak check.
|
||||
*/
|
||||
#if SOC_HMAC_SUPPORTED
|
||||
esp_crypto_hmac_lock_acquire();
|
||||
esp_crypto_hmac_lock_release();
|
||||
#endif
|
||||
|
||||
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
|
||||
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user