Skip to content

Commit

Permalink
Fix mem leaks.
Browse files Browse the repository at this point in the history
Not freeing the list element with the user-defined
function might miss memory.
  • Loading branch information
Rot127 authored and XVilka committed Nov 29, 2023
1 parent e0babbc commit fdc2b81
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions librz/util/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-only

#include <stdio.h>
#include "rz_util.h"
#include <rz_util.h>

/**
* \brief returns the next RzList iterator in the list
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit fdc2b81

Please sign in to comment.