diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0c08731d9..962b55474f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Bugfix * Use all allowed channels with Brazil domain +* Corrected memory leak on Border Router key storage that could occur when key storage is allocated on low memory situation ## Release v12.7.0 (14-12-2020) diff --git a/source/6LoWPAN/ws/ws_pae_key_storage.c b/source/6LoWPAN/ws/ws_pae_key_storage.c index 7ee66a073a9..e8026364a3d 100644 --- a/source/6LoWPAN/ws/ws_pae_key_storage.c +++ b/source/6LoWPAN/ws/ws_pae_key_storage.c @@ -186,6 +186,7 @@ static int8_t ws_pae_key_storage_allocate(const void *instance, uint16_t key_sto if (new_storage_array == NULL) { key_storage_array->storage_array_handle = ns_dyn_mem_alloc(key_storage_size); if (!key_storage_array->storage_array_handle) { + ns_dyn_mem_free(key_storage_array); return -1; } key_storage_array->allocated = true;