DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fOv18K+unub7ZcSn/HwTIzHYjgGINDh3Dq3WE9rC+yI=; b=HeWJrZL5P6pZHyUIGQj2wqIXoWEoWiW3SlTnGAGQrA0Cba04yoZfgs5UkJvtKEFeT+ kAazKfbVrCrnJHb12H04AMbyn2+59YrKteVySydZgEDTO27frRfHw43ni/Uikn/j85Lc s/Mdj5Qy9pjUQw2aMufp52ctmTu+CwnZB+IsEeTBfiOz+qHbRg58+24GmmP9f4/UNuQr P3USfD/556ybqexytkB6qccck7NENCc4TOs9xdI23BdjNprJNEmr2OSwRHaxZ4D3Sn3z HNv0JOCJMfe+5D7NhjtMStI5W0qATLUooMVpb70VVmzZ9K3Y0owwBgdgE3E6+m07UpVj Sh0w== From: Mahmoud Mandour Date: Tue, 20 Apr 2021 17:46:36 +0200 Message-Id: <20210420154643.58439-2-ma.mandourr@gmail.com> In-Reply-To: <20210420154643.58439-1-ma.mandourr@gmail.com> References: <20210420154643.58439-1-ma.mandourr@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [Virtio-fs] [PATCH v2 1/7] virtiofsd: Changed allocations of fuse_req to GLib functions List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "open list:virtiofs" , Mahmoud Mandour Replaced the allocation and deallocation of fuse_req structs using calloc()/free() call pairs to a GLib's g_try_new0() and g_free(). Signed-off-by: Mahmoud Mandour Reviewed-by: Stefan Hajnoczi --- tools/virtiofsd/fuse_lowlevel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c index 58e32fc963..812cef6ef6 100644 --- a/tools/virtiofsd/fuse_lowlevel.c +++ b/tools/virtiofsd/fuse_lowlevel.c @@ -106,7 +106,7 @@ static void list_add_req(struct fuse_req *req, struct fuse_req *next) static void destroy_req(fuse_req_t req) { pthread_mutex_destroy(&req->lock); - free(req); + g_free(req); } void fuse_free_req(fuse_req_t req) @@ -130,7 +130,7 @@ static struct fuse_req *fuse_ll_alloc_req(struct fuse_session *se) { struct fuse_req *req; - req = (struct fuse_req *)calloc(1, sizeof(struct fuse_req)); + req = g_try_new0(struct fuse_req, 1); if (req == NULL) { fuse_log(FUSE_LOG_ERR, "fuse: failed to allocate request\n"); } else { @@ -1684,7 +1684,7 @@ static struct fuse_req *check_interrupt(struct fuse_session *se, if (curr->u.i.unique == req->unique) { req->interrupted = 1; list_del_req(curr); - free(curr); + g_free(curr); return NULL; } } -- 2.25.1