From 0374f7401385cb19ee00d6642a4cbc1773fbb863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=20Lepp=C3=A4nen?= Date: Thu, 31 Dec 2020 13:59:40 +0200 Subject: [PATCH] Corrected memory leak on key storage allocation on low memory situation --- CHANGELOG.md | 1 + source/6LoWPAN/ws/ws_pae_key_storage.c | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0c08731d9c..962b55474f39 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 7ee66a073a9a..e8026364a3d0 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;