From fdc2b8111d8f5270d2a59d3c5f4257e8ade23ae1 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Wed, 29 Nov 2023 15:26:33 -0500 Subject: [PATCH] Fix mem leaks. Not freeing the list element with the user-defined function might miss memory. --- librz/util/list.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/librz/util/list.c b/librz/util/list.c index 0e6a05bcde5..44c6579458d 100644 --- a/librz/util/list.c +++ b/librz/util/list.c @@ -3,7 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-only #include -#include "rz_util.h" +#include /** * \brief returns the next RzList iterator in the list @@ -434,8 +434,7 @@ RZ_API ut32 rz_list_del_n(RZ_NONNULL RzList *list, ut32 n) { it->p->n = it->n; it->n->p = it->p; } - free(it); - list->length--; + rz_list_delete(list, it); return true; } }