On Wed, Nov 21, 2012 at 8:38 AM, Olivia Yin <hong-hua....@freescale.com> wrote: > Signed-off-by: Olivia Yin <hong-hua....@freescale.com> > --- > hw/elf_ops.h | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/hw/elf_ops.h b/hw/elf_ops.h > index b346861..9c76a75 100644 > --- a/hw/elf_ops.h > +++ b/hw/elf_ops.h > @@ -178,6 +178,8 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, > int fd, int must_swab, > s->disas_strtab = str; > s->next = syminfos; > syminfos = s; > + g_free(syms); > + g_free(str); > g_free(shdr_table); > return 0; > fail:
Olivia, as Alex pointed out there are references to syms and str in the struct "s"....so you can't just free those I don't think. The problem that leaves us with is that on every reset when we call load_elf() that we re-load and re-malloc space for the symbols. I think the solution may be to factor out the call to load_symbols() from load_elf(). It looks like what load_symbols does in the end is set the variable syminfos to point to the loaded symbol info. If you factor load_symbols() out then in load_elf_32/64() you would do something like: elf_phy_loader_32/64() load_symbols_32/64(). We don't need to be reloading symbols on every reset. Alex, does that make sense? Stuart