[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/15] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 10/15] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc |
Date: |
Wed, 26 May 2021 18:45:35 +0100 |
From: Mahmoud Mandour <ma.mandourr@gmail.com>
Replaced a malloc() call and its respective free() with
GLib's g_try_malloc() and g_free() calls.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Message-Id: <20210314032324.45142-8-ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
tools/virtiofsd/fuse_opt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c
index f0ab8d22f4..9d371448e9 100644
--- a/tools/virtiofsd/fuse_opt.c
+++ b/tools/virtiofsd/fuse_opt.c
@@ -272,7 +272,7 @@ static int process_opt_sep_arg(struct fuse_opt_context *ctx,
}
param = ctx->argv[ctx->argctr];
- newarg = malloc(sep + strlen(param) + 1);
+ newarg = g_try_malloc(sep + strlen(param) + 1);
if (!newarg) {
return alloc_failed();
}
@@ -280,7 +280,7 @@ static int process_opt_sep_arg(struct fuse_opt_context *ctx,
memcpy(newarg, arg, sep);
strcpy(newarg + sep, param);
res = process_opt(ctx, opt, sep, newarg, iso);
- free(newarg);
+ g_free(newarg);
return res;
}
--
2.31.1
- [PULL 00/15] migration/virtiofs/hmp queue, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 02/15] virtiofsd: Check for EINTR in preadv() and retry, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 01/15] hmp: Fix loadvm to resume the VM on success instead of failure, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 03/15] virtiofsd: Get rid of unreachable code in read, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 05/15] virtiofsd: get rid of in_sg_left variable, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 04/15] virtiofsd: Use iov_discard_front() to skip bytes, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 06/15] virtiofsd: Simplify skip byte logic, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 08/15] virtiofsd: Set req->reply_sent right after sending reply, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 07/15] virtiofsd: Check EOF before short read, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 10/15] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc,
Dr. David Alan Gilbert (git) <=
- [PULL 11/15] migration/rdma: Fix cm_event used before being initialized, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 14/15] migration/rdma: destination: create the return patch after the first accept, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 15/15] migration/rdma: source: poll cm_event from return path, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 09/15] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 12/15] migration/rdma: cleanup rdma in rdma_start_incoming_migration error path, Dr. David Alan Gilbert (git), 2021/05/26
- [PULL 13/15] migration/rdma: Fix rdma_addrinfo res leaks, Dr. David Alan Gilbert (git), 2021/05/26
- Re: [PULL 00/15] migration/virtiofs/hmp queue, Peter Maydell, 2021/05/27