From 9d134cbd5e45557c7598569304f20f0b3fff69e0 Mon Sep 17 00:00:00 2001 From: Sergei Rashitov <sergei.rashitov@demlabs.net> Date: Wed, 24 Jun 2020 21:19:28 +0700 Subject: [PATCH] [*] Fix memory leak in gdb history API --- modules/global-db/dap_chain_global_db_hist.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/global-db/dap_chain_global_db_hist.c b/modules/global-db/dap_chain_global_db_hist.c index 49195daf7d..2711c371ce 100644 --- a/modules/global-db/dap_chain_global_db_hist.c +++ b/modules/global-db/dap_chain_global_db_hist.c @@ -1130,11 +1130,13 @@ bool dap_db_history_truncate(void) */ uint64_t dap_db_log_get_group_history_last_id(const char *a_history_group_name) { + uint64_t result = 0; dap_store_obj_t *l_last_obj = dap_chain_global_db_get_last(a_history_group_name); if(l_last_obj) { - return l_last_obj->id; - }else - return 0; + result = l_last_obj->id; + dap_store_obj_free(l_last_obj, 1); + } + return result; } /** -- GitLab