:Use qemu_malloc & qemu_free instead of malloc & free
PATCH 1/1 :Use qemu_malloc & qemu_free instead of malloc & free
Use qemu_malloc & qemu_free instead of malloc & free
Signed-off-by vibi <[email protected]>
--- qemu-sockets.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
qemu-sockets.c +0 -0
@@ -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
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
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