From 5b1ae51c6bb2a69e94d3a8a0a3ef96ed627256d9 Mon Sep 17 00:00:00 2001 From: Andrew Lindesay Date: Sun, 13 Dec 2020 21:17:08 +1300 Subject: [PATCH] HaikuDepot: Memory Leak Fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibd311d10009484ba834843149740c5a11f283202 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3500 Reviewed-by: Stephan Aßmus --- headers/private/shared/LRUCache.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/headers/private/shared/LRUCache.h b/headers/private/shared/LRUCache.h index 57f35afcfa..3df0d9f897 100644 --- a/headers/private/shared/LRUCache.h +++ b/headers/private/shared/LRUCache.h @@ -88,8 +88,10 @@ public: if (node == NULL) return B_NO_MEMORY; status_t result = fMap.Put(key, node); - if (result != B_OK) + if (result != B_OK) { + delete node; return result; + } _SetNewestNode(node); _PurgeExcess(); }