diff mbox

free the memory malloced by load_at()

Message ID 1353048452-27338-1-git-send-email-hong-hua.yin@freescale.com
State New
Headers show

Commit Message

Olivia Yin Nov. 16, 2012, 6:47 a.m. UTC
Signed-off-by: Olivia Yin <hong-hua.yin@freescale.com>
---
 hw/elf_ops.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Alexander Graf Nov. 19, 2012, 10:46 a.m. UTC | #1
On 16.11.2012, at 07:47, Olivia Yin wrote:

> Signed-off-by: Olivia Yin <hong-hua.yin@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 db4630e..4495932 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);

Syms and str can both still be dereferenced at this point in time.


Alex

>     g_free(shdr_table);
>     return 0;
>  fail:
> -- 
> 1.7.0.4
> 
> 
>
diff mbox

Patch

diff --git a/hw/elf_ops.h b/hw/elf_ops.h
index db4630e..4495932 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: