[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/9] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's
From: |
Mahmoud Mandour |
Subject: |
[PATCH 7/9] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0 |
Date: |
Sat, 13 Mar 2021 18:36:51 +0200 |
Replaced a call to calloc() and its respective free() call
with GLib's g_try_new0() and g_free() calls.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
tools/virtiofsd/buffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
index 874f01c488..b5f04be356 100644
--- a/tools/virtiofsd/buffer.c
+++ b/tools/virtiofsd/buffer.c
@@ -37,7 +37,7 @@ static ssize_t fuse_buf_writev(struct fuse_buf *out_buf,
struct iovec *iov;
int fd = out_buf->fd;
- iov = calloc(iovcnt, sizeof(struct iovec));
+ iov = g_try_new0(struct iovec, iovcnt);
if (!iov) {
return -ENOMEM;
}
@@ -61,7 +61,7 @@ static ssize_t fuse_buf_writev(struct fuse_buf *out_buf,
res = -errno;
}
- free(iov);
+ g_free(iov);
return res;
}
--
2.25.1
- [PATCH 0/9] Replacing malloc and the like with GLib's variants, Mahmoud Mandour, 2021/03/13
- [PATCH 1/9] bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants, Mahmoud Mandour, 2021/03/13
- [PATCH 2/9] hw/audio/fmopl.c: Fixing some style errors., Mahmoud Mandour, 2021/03/13
- [PATCH 8/9] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc, Mahmoud Mandour, 2021/03/13
- [PATCH 6/9] util/compatfd.c: Replaced a malloc with GLib's g_try_malloc, Mahmoud Mandour, 2021/03/13
- [PATCH 5/9] target/xtensa: Replaced malloc/free with GLib's variants., Mahmoud Mandour, 2021/03/13
- [PATCH 3/9] hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants, Mahmoud Mandour, 2021/03/13
- [PATCH 7/9] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0,
Mahmoud Mandour <=
- [PATCH 4/9] pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variants, Mahmoud Mandour, 2021/03/13
- [PATCH 9/9] tools/virtiofsd: Replacing malloc-like calls with GLib's variants, Mahmoud Mandour, 2021/03/13
- Re: [PATCH 0/9] Replacing malloc and the like with GLib's variants, no-reply, 2021/03/13