qemu-devel
[Top][All Lists]
Advanced

[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

Attachment: signature.asc
Description: PGP signature


reply via email to

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