Skip to contentSkip to conversation

:Use qemu_malloc & qemu_free instead of malloc & free

PATCH In review vibisreenivasan 2 participants 3 messages May 5, 2009 – May 6, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 :Use qemu_malloc & qemu_free instead of malloc & free

Use qemu_malloc & qemu_free instead of malloc & free

---
 qemu-sockets.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
qemu-sockets.c +0 -0
index 4111f82..f918dc0 100644
@@ -329,7 +329,7 @@ int unix_listen(const char *str, char *ostr, int

olen)

     opts = strchr(str, ',');
     if (opts) {
         len = opts - str;
-        path = malloc(len+1);
+        path = qemu_malloc(len+1);
         snprintf(path, len+1, "%.*s", len, str);
     } else
         path = strdup(str);

@@ -365,11 +365,11 @@ int unix_listen(const char *str, char *ostr, int olen)

     if (sockets_debug)
         fprintf(stderr, "bind(unix:%s): OK\n", un.sun_path);
-    free(path);
+    qemu_free(path);
     return sock;

err:
- free(path);

+    qemu_free(path);
     closesocket(sock);
     return -1;

}

Signature · 1 line
1.6.0
#1 lore raw

Hi,

Review

Quoted 5 lines
(quoted diff) +1 -1
-        path = malloc(len+1);
+        path = qemu_malloc(len+1);
          snprintf(path, len+1, "%.*s", len, str);
      } else
          path = strdup(str);

You need s/strdup/qemu_strdup/ here (and maybe elsewhere too), otherwise you'll mix strdup + qemu_free().

cheers,
Gerd

#2 lore raw

hi Gred,
Thanks for pointing that out.
I will update patch & send it again.
regards
vibi

Quoted 15 lines · Gerd Hoffmann

Hi,

Review

Quoted 5 lines
(quoted diff) +1 -1
-        path = malloc(len+1);
+        path = qemu_malloc(len+1);
          snprintf(path, len+1, "%.*s", len, str);
      } else
          path = strdup(str);

You need s/strdup/qemu_strdup/ here (and maybe elsewhere too), otherwise you'll mix strdup + qemu_free().

cheers,
Gerd