summaryrefslogtreecommitdiffstats
path: root/tools/virtiofsd
diff options
context:
space:
mode:
authorMahmoud Mandour2021-03-14 04:23:22 +0100
committerDr. David Alan Gilbert2021-05-26 19:39:32 +0200
commitd14d4f4f1815dcf63fa6b90e9a34854977e42f84 (patch)
tree59814c3ce6d2ab7fcb772d0720559fa7e60cbfaa /tools/virtiofsd
parentvirtiofsd: Set req->reply_sent right after sending reply (diff)
downloadqemu-d14d4f4f1815dcf63fa6b90e9a34854977e42f84.tar.gz
qemu-d14d4f4f1815dcf63fa6b90e9a34854977e42f84.tar.xz
qemu-d14d4f4f1815dcf63fa6b90e9a34854977e42f84.zip
tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0
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> Message-Id: <20210314032324.45142-7-ma.mandourr@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tools/virtiofsd')
-rw-r--r--tools/virtiofsd/buffer.c4
1 files 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;
}