]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0
authorMahmoud Mandour <ma.mandourr@gmail.com>
Sun, 14 Mar 2021 03:23:22 +0000 (05:23 +0200)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 26 May 2021 17:39:32 +0000 (18:39 +0100)
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>
tools/virtiofsd/buffer.c

index 874f01c4882b4bcc56433128d26d9e3914b97fc3..b5f04be356fb7f1cc1b1bbe3686440a62b030024 100644 (file)
@@ -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;
 }