[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH 69/88] virtio-9p: use g_new() family of functi
From: |
Greg Kurz |
Subject: |
Re: [Qemu-trivial] [PATCH 69/88] virtio-9p: use g_new() family of functions |
Date: |
Sat, 7 Oct 2017 14:51:53 +0200 |
On Fri, 6 Oct 2017 20:50:04 -0300
Philippe Mathieu-Daudé <address@hidden> wrote:
> From: Marc-André Lureau <address@hidden>
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> [PMD: added 2 more uses in hw/9pfs/9p-synth.c]
> ---
Acked-by: Greg Kurz <address@hidden>
> hw/9pfs/9p-handle.c | 2 +-
> hw/9pfs/9p-proxy.c | 2 +-
> hw/9pfs/9p-synth.c | 8 ++++----
> hw/9pfs/9p.c | 2 +-
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c
> index 9875f1894c..357ced3079 100644
> --- a/hw/9pfs/9p-handle.c
> +++ b/hw/9pfs/9p-handle.c
> @@ -609,7 +609,7 @@ static int handle_init(FsContext *ctx)
> int ret, mnt_id;
> struct statfs stbuf;
> struct file_handle fh;
> - struct handle_data *data = g_malloc(sizeof(struct handle_data));
> + struct handle_data *data = g_new(struct handle_data, 1);
>
> data->mountfd = open(ctx->fs_root, O_DIRECTORY);
> if (data->mountfd < 0) {
> diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c
> index 28b20a7c3d..2de303d713 100644
> --- a/hw/9pfs/9p-proxy.c
> +++ b/hw/9pfs/9p-proxy.c
> @@ -1136,7 +1136,7 @@ static int proxy_parse_opts(QemuOpts *opts, struct
> FsDriverEntry *fs)
>
> static int proxy_init(FsContext *ctx)
> {
> - V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));
> + V9fsProxy *proxy = g_new(V9fsProxy, 1);
> int sock_id;
>
> if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {
> diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c
> index df0a8de08a..3aa69cf465 100644
> --- a/hw/9pfs/9p-synth.c
> +++ b/hw/9pfs/9p-synth.c
> @@ -43,7 +43,7 @@ static V9fsSynthNode *v9fs_add_dir_node(V9fsSynthNode
> *parent, int mode,
>
> /* Add directory type and remove write bits */
> mode = ((mode & 0777) | S_IFDIR) & ~(S_IWUSR | S_IWGRP | S_IWOTH);
> - node = g_malloc0(sizeof(V9fsSynthNode));
> + node = g_new0(V9fsSynthNode, 1);
> if (attr) {
> /* We are adding .. or . entries */
> node->attr = attr;
> @@ -124,7 +124,7 @@ int qemu_v9fs_synth_add_file(V9fsSynthNode *parent, int
> mode,
> }
> /* Add file type and remove write bits */
> mode = ((mode & 0777) | S_IFREG);
> - node = g_malloc0(sizeof(V9fsSynthNode));
> + node = g_new0(V9fsSynthNode, 1);
> node->attr = &node->actual_attr;
> node->attr->inode = synth_node_count++;
> node->attr->nlink = 1;
> @@ -180,7 +180,7 @@ static int synth_opendir(FsContext *ctx,
> V9fsSynthOpenState *synth_open;
> V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data;
>
> - synth_open = g_malloc(sizeof(*synth_open));
> + synth_open = g_new(V9fsSynthOpenState, 1);
> synth_open->node = node;
> node->open_count++;
> fs->private = synth_open;
> @@ -264,7 +264,7 @@ static int synth_open(FsContext *ctx, V9fsPath *fs_path,
> V9fsSynthOpenState *synth_open;
> V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data;
>
> - synth_open = g_malloc(sizeof(*synth_open));
> + synth_open = g_new(V9fsSynthOpenState, 1);
> synth_open->node = node;
> node->open_count++;
> fs->private = synth_open;
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index 23ac7bb532..510867b4dc 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -298,7 +298,7 @@ static V9fsFidState *alloc_fid(V9fsState *s, int32_t fid)
> return NULL;
> }
> }
> - f = g_malloc0(sizeof(V9fsFidState));
> + f = g_new0(V9fsFidState, 1);
> f->fid = fid;
> f->fid_type = P9_FID_NONE;
> f->ref = 1;
- [Qemu-trivial] [PATCH 62/88] user: use g_new() family of functions, (continued)
- [Qemu-trivial] [PATCH 62/88] user: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 63/88] bsd-user/syscall: fix a memory leak on EFAULT, use g_new(), Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 64/88] user: use g_strfreev(), Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 65/88] util: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 66/88] util/qemu-thread-win32: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 67/88] util/coroutine: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 68/88] virtio: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 69/88] virtio-9p: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- Re: [Qemu-trivial] [PATCH 69/88] virtio-9p: use g_new() family of functions,
Greg Kurz <=
- [Qemu-trivial] [PATCH 70/88] block: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 72/88] hw/block/nvme: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 71/88] block: avoid use of g_new0(), Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 73/88] hw/block/xen_disk: avoid use of g_new0(), Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 74/88] balloon: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 75/88] decnumber: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 76/88] dma: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 77/88] dump: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06