mirror of https://github.com/proxmox/mirror_qemu
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>master
parent
b5fd59cf90
commit
d14d4f4f18
|
@ -37,7 +37,7 @@ static ssize_t fuse_buf_writev(struct fuse_buf *out_buf,
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
int fd = out_buf->fd;
|
int fd = out_buf->fd;
|
||||||
|
|
||||||
iov = calloc(iovcnt, sizeof(struct iovec));
|
iov = g_try_new0(struct iovec, iovcnt);
|
||||||
if (!iov) {
|
if (!iov) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ static ssize_t fuse_buf_writev(struct fuse_buf *out_buf,
|
||||||
res = -errno;
|
res = -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(iov);
|
g_free(iov);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue