elfload: Replace malloc with g_malloc
PATCH 1/1 elfload: Replace malloc with g_malloc
Signed-off-by Mao Zhongyi <[email protected]>
--- bsd-user/elfload.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
bsd-user/elfload.c +6 -6
@@ -1064,22 +1064,22 @@ static void load_symbols(struct elfhdr *hdr, int fd) found:/* Now know where the strtab and symtab are. Snarf them. */ - s =malloc (sizeof (*s)); + s =g_malloc (sizeof (*s)); syms =malloc (symtab.sh_size);if (!syms) { -free (s); +g_free (s);return ; } s->disas_strtab = strings =malloc (strtab.sh_size);if (!s->disas_strtab) { -free (s); +g_free (s);free (syms);return ; }lseek (fd, symtab.sh_offset,SEEK_SET );if (read (fd, syms, symtab.sh_size) != symtab.sh_size) { -free (s); +g_free (s);free (syms);free (strings);return ;
@@ -1115,7 +1115,7 @@ static void load_symbols(struct elfhdr *hdr, int fd)many symbols we managed to discard. */ new_syms =realloc (syms, nsyms *sizeof (*syms));if (new_syms ==NULL ) { -free (s); +g_free (s);free (syms);free (strings);return ;
@@ -1126,7 +1126,7 @@ static void load_symbols(struct elfhdr *hdr, int fd)lseek (fd, strtab.sh_offset,SEEK_SET );if (read (fd, strings, strtab.sh_size) != strtab.sh_size) { -free (s); +g_free (s);free (syms);free (strings);return ;
Signature · 1 line
2.7.4
Quoted 4 lines · Mao Zhongyi
Signed-off-by Mao Zhongyi <[email protected]>--- bsd-user/elfload.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Thanks for this patch. How have you tested it? (You'd need to be on a BSD host system to test). I ask because bsd-user is currently not really maintained, and so I'm a bit reluctant to take cleanup patches to code we aren't building and testing.
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 4 lines · Mao Zhongyi
Signed-off-by Mao Zhongyi <[email protected]>--- bsd-user/elfload.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)Thanks for this patch. How have you tested it? (You'd need to be on a BSD host system to test). I ask because bsd-user is currently not really maintained, and so I'm a bit reluctant to take cleanup patches to code we aren't building and testing.
Thanks for your quick response, due to lack of environment, I just have done make check, will install a bsd host as soon as possible. Is just starting qemu in bsd enough for test?
thanks
-- Mao