All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc
@ 2017-03-21 10:19 Mao Zhongyi
  2017-03-21 10:50 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Mao Zhongyi @ 2017-03-21 10:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, peter.maydell

Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
---
 bsd-user/elfload.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index 41a1309..17dfaca 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc
  2017-03-21 10:19 [Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc Mao Zhongyi
@ 2017-03-21 10:50 ` Peter Maydell
  2017-03-21 11:45   ` Mao Zhongyi
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2017-03-21 10:50 UTC (permalink / raw)
  To: Mao Zhongyi; +Cc: QEMU Developers, Paolo Bonzini

On 21 March 2017 at 10:19, Mao Zhongyi <maozy.fnst@cn.fujitsu.com> wrote:
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc
  2017-03-21 10:50 ` Peter Maydell
@ 2017-03-21 11:45   ` Mao Zhongyi
  0 siblings, 0 replies; 3+ messages in thread
From: Mao Zhongyi @ 2017-03-21 11:45 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Paolo Bonzini



On 03/21/2017 06:50 PM, Peter Maydell wrote:
> On 21 March 2017 at 10:19, Mao Zhongyi <maozy.fnst@cn.fujitsu.com> wrote:
>> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
>> ---
>>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-21 11:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 10:19 [Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc Mao Zhongyi
2017-03-21 10:50 ` Peter Maydell
2017-03-21 11:45   ` Mao Zhongyi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.