[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 8/8] tools/virtiofsd: Replacing malloc-like calls with GLib's
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 8/8] tools/virtiofsd: Replacing malloc-like calls with GLib's variants |
Date: |
Mon, 15 Mar 2021 10:01:11 +0000 |
On Sun, Mar 14, 2021 at 05:23:24AM +0200, Mahmoud Mandour wrote:
> @@ -130,7 +130,7 @@ static struct fuse_req *fuse_ll_alloc_req(struct
> fuse_session *se)
> {
> struct fuse_req *req;
>
> - req = (struct fuse_req *)calloc(1, sizeof(struct fuse_req));
> + req = g_try_new(struct fuse_req, 1);
g_try_new0() since the original call was calloc(3)?
> @@ -411,7 +411,7 @@ static int lo_map_grow(struct lo_map *map, size_t
> new_nelems)
> return 1;
> }
>
> - new_elems = realloc(map->elems, sizeof(map->elems[0]) * new_nelems);
> + new_elems = g_realloc_n(map->elems, new_nelems, sizeof(map->elems[0]));
g_try_realloc_n() since failure is handled below?
Stefan
signature.asc
Description: PGP signature
- [PATCH 4/8] target/xtensa: Replaced malloc/free with GLib's variants, (continued)
- [PATCH 4/8] target/xtensa: Replaced malloc/free with GLib's variants, Mahmoud Mandour, 2021/03/13
- [PATCH 7/8] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc, Mahmoud Mandour, 2021/03/13
- [PATCH 3/8] hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants, Mahmoud Mandour, 2021/03/13
- [PATCH 6/8] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0, Mahmoud Mandour, 2021/03/13
- [PATCH 8/8] tools/virtiofsd: Replacing malloc-like calls with GLib's variants, Mahmoud Mandour, 2021/03/13
- Re: [PATCH 8/8] tools/virtiofsd: Replacing malloc-like calls with GLib's variants,
Stefan Hajnoczi <=