From 6c2079660043aecd6a1259063d6b371124c95c38 Mon Sep 17 00:00:00 2001 From: Pavel I Date: Mon, 14 Aug 2023 02:40:06 +0400 Subject: [PATCH] Fix memleak in parse_relocs_from_indirect_syms() --- librz/bin/format/mach0/mach0_relocs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/librz/bin/format/mach0/mach0_relocs.c b/librz/bin/format/mach0/mach0_relocs.c index 5e78c38b00..0a53b1a2d0 100644 --- a/librz/bin/format/mach0/mach0_relocs.c +++ b/librz/bin/format/mach0/mach0_relocs.c @@ -507,7 +507,10 @@ static void parse_relocs_from_indirect_syms(RzSkipList *dst, struct MACH0_(obj_t break; } reloc->ord = j; - rz_skiplist_insert(dst, reloc); + RzSkipListNode *node = rz_skiplist_insert(dst, reloc); + if (node->data != reloc) { + free(reloc); + } } }