From 52a64537fb317deb7d1aab5ba967098110a0e90f Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 20 Jul 2020 09:19:52 +0200 Subject: [PATCH] Fix null deref in aao (#17313) --- libr/bin/p/bin_elf.inc | 2 +- libr/core/anal_objc.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libr/bin/p/bin_elf.inc b/libr/bin/p/bin_elf.inc index 6d98aacb3a..084828da0a 100644 --- a/libr/bin/p/bin_elf.inc +++ b/libr/bin/p/bin_elf.inc @@ -687,7 +687,7 @@ static RBinReloc *reloc_convert(struct Elf_(r_bin_elf_obj_t) *bin, RBinElfReloc #undef ADD free (r); - return 0; + return NULL; } static RList* relocs(RBinFile *bf) { diff --git a/libr/core/anal_objc.c b/libr/core/anal_objc.c index a3088e09d0..141d7dc537 100644 --- a/libr/core/anal_objc.c +++ b/libr/core/anal_objc.c @@ -204,8 +204,10 @@ static RCoreObjc *core_objc_new(RCore *core) { } static void core_objc_free(RCoreObjc *o) { - ht_up_free (o->up); - free (o); + if (o) { + ht_up_free (o->up); + free (o); + } } static bool objc_find_refs(RCore *core) {