diff --git a/libr/bin/p/bin_elf.c b/libr/bin/p/bin_elf.c index 58f5eb8e84..0f6a96c6f3 100644 --- a/libr/bin/p/bin_elf.c +++ b/libr/bin/p/bin_elf.c @@ -20,7 +20,7 @@ static void setsymord (ELFOBJ* eobj, ut32 ord, RBinSymbol *ptr) { } static void setimpord (ELFOBJ* eobj, ut32 ord, RBinImport *ptr) { - if (!eobj->imports_by_ord && ord >= eobj->imports_by_ord_size) + if (!eobj->imports_by_ord || ord >= eobj->imports_by_ord_size) return; free (eobj->imports_by_ord[ord]); eobj->imports_by_ord[ord] = r_mem_dup (ptr, sizeof (RBinImport)); @@ -208,7 +208,7 @@ static RList* sections(RBinFile *arch) { } static RList* symbols(RBinFile *arch) { - int i, has_va = Elf_(r_bin_elf_has_va) (arch->o->bin_obj); + int i, has_va; struct Elf_(r_bin_elf_obj_t) *bin; struct r_bin_elf_symbol_t *symbol = NULL; RBinSymbol *ptr = NULL; @@ -217,6 +217,7 @@ static RList* symbols(RBinFile *arch) { if (!arch || !arch->o || !arch->o->bin_obj) return NULL; bin = arch->o->bin_obj; + has_va = Elf_(r_bin_elf_has_va) (bin); if (!has_va) { // find base address for non-linked object (.o) // if (arch->o->sections) { diff --git a/libr/core/anal.c b/libr/core/anal.c index c487a62ffb..b783efa763 100644 --- a/libr/core/anal.c +++ b/libr/core/anal.c @@ -754,7 +754,7 @@ else eprintf ("Invalid reference from 0x%08"PFMT64x " to 0x%08"PFMT64x"\n", fcni->addr, fcnr->addr); fr = &fakefr; - free (fr->name); + if (fr) free (fr->name); fr->name = malloc (32); snprintf (fr->name, 31, "unk.0x%"PFMT64x, fcnr->addr); }