qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v4 03/12] fix qemu_alloc/qemu_free for bsd-user subs


From: Jean-Christophe DUBOIS
Subject: [Qemu-devel] [PATCH v4 03/12] fix qemu_alloc/qemu_free for bsd-user subsystem
Date: Thu, 18 Jun 2009 22:50:10 +0200

From: Jean-Christophe Dubois <address@hidden(none)>

Signed-off-by: Jean-Christophe DUBOIS <address@hidden>
---
 bsd-user/main.c |    6 +++---
 bsd-user/path.c |   10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 827c9c3..c2c9c17 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -822,7 +822,7 @@ int main(int argc, char **argv)
     while (*(wrk++))
         environ_count++;
 
-    target_environ = malloc((environ_count + 1) * sizeof(char *));
+    target_environ = qemu_malloc((environ_count + 1) * sizeof(char *));
     if (!target_environ)
         abort();
     for (wrk = environ, dst = target_environ; *wrk; wrk++) {
@@ -838,10 +838,10 @@ int main(int argc, char **argv)
     }
 
     for (wrk = target_environ; *wrk; wrk++) {
-        free(*wrk);
+        qemu_free(*wrk);
     }
 
-    free(target_environ);
+    qemu_free(target_environ);
 
     if (qemu_log_enabled()) {
         log_page_dump();
diff --git a/bsd-user/path.c b/bsd-user/path.c
index 5c40ec7..56831b3 100644
--- a/bsd-user/path.c
+++ b/bsd-user/path.c
@@ -45,8 +45,8 @@ static struct pathelem *new_entry(const char *root,
                                   struct pathelem *parent,
                                   const char *name)
 {
-    struct pathelem *new = malloc(sizeof(*new));
-    new->name = strdup(name);
+    struct pathelem *new = qemu_malloc(sizeof(*new));
+    new->name = qemu_strdup(name);
     asprintf(&new->pathname, "%s/%s", root, name);
     new->num_entries = 0;
     return new;
@@ -75,7 +75,7 @@ static struct pathelem *add_entry(struct pathelem *root, 
const char *name)
 {
     root->num_entries++;
 
-    root = realloc(root, sizeof(*root)
+    root = qemu_realloc(root, sizeof(*root)
                    + sizeof(root->entries[0])*root->num_entries);
 
     root->entries[root->num_entries-1] = new_entry(root->pathname, root, name);
@@ -137,14 +137,14 @@ void init_paths(const char *prefix)
         pstrcpy(pref_buf, sizeof(pref_buf), cwd);
         pstrcat(pref_buf, pref_buf_len, "/");
         pstrcat(pref_buf, pref_buf_len, prefix);
-        free(cwd);
+        qemu_free(cwd);
     } else
         pstrcpy(pref_buf, sizeof(pref_buf), prefix + 1);
 
     base = new_entry("", NULL, pref_buf);
     base = add_dir_maybe(base);
     if (base->num_entries == 0) {
-        free (base);
+        qemu_free (base);
         base = NULL;
     } else {
         set_parents(base, base);
-- 
1.6.0.4





reply via email to

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