qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc


From: Mao Zhongyi
Subject: [Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc
Date: Tue, 21 Mar 2017 18:19:41 +0800

Signed-off-by: Mao Zhongyi <address@hidden>
---
 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]