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: Mahmoud Mandour
Subject: Re: [PATCH 8/8] tools/virtiofsd: Replacing malloc-like calls with GLib's variants
Date: Mon, 15 Mar 2021 12:46:29 +0200



On Mon, Mar 15, 2021 at 12:01 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
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

Hello Mr. Stefan,

You're correct. I'm really sorry for such small and strangely obvious errors.
If the patch is going to be ACKed, will you edit those problems or shall I fix them and
resend the patch again alone?  

reply via email to

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