[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] virtiofsd: Changed fuse_pollhandle allocation to GLib's func
From: |
Mahmoud Mandour |
Subject: |
[PATCH 3/8] virtiofsd: Changed fuse_pollhandle allocation to GLib's functions |
Date: |
Fri, 19 Mar 2021 15:25:22 +0200 |
Changed allocation of fuse_pollhandle structs to GLib's g_new().
Removed the null checking as allocating such a small memory segment
should always succeed on a healthy system. Otherwise, the system
is already in a critical state.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
tools/virtiofsd/fuse_lowlevel.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
index 66607100f2..45527ff703 100644
--- a/tools/virtiofsd/fuse_lowlevel.c
+++ b/tools/virtiofsd/fuse_lowlevel.c
@@ -1755,7 +1755,7 @@ static void do_ioctl(fuse_req_t req, fuse_ino_t nodeid,
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph)
{
- free(ph);
+ g_free(ph);
}
static void do_poll(fuse_req_t req, fuse_ino_t nodeid,
@@ -1778,11 +1778,7 @@ static void do_poll(fuse_req_t req, fuse_ino_t nodeid,
struct fuse_pollhandle *ph = NULL;
if (arg->flags & FUSE_POLL_SCHEDULE_NOTIFY) {
- ph = malloc(sizeof(struct fuse_pollhandle));
- if (ph == NULL) {
- fuse_reply_err(req, ENOMEM);
- return;
- }
+ ph = g_new(struct fuse_pollhandle, 1);
ph->kh = arg->kh;
ph->se = req->se;
}
--
2.25.1
- [PATCH 0/8] virtiofsd: Changed various allocations to GLib functions, Mahmoud Mandour, 2021/03/19
- [PATCH 1/8] virtiofsd: Changed allocations of fuse_req to GLib functions, Mahmoud Mandour, 2021/03/19
- [PATCH 2/8] virtiofds: Changed allocations of iovec to GLib's functions, Mahmoud Mandour, 2021/03/19
- [PATCH 4/8] virtiofsd: Changed allocations of fuse_session to GLib's functions, Mahmoud Mandour, 2021/03/19
- [PATCH 3/8] virtiofsd: Changed fuse_pollhandle allocation to GLib's functions,
Mahmoud Mandour <=
- [PATCH 6/8] virtiofsd: Changed allocations of fv_VuDev & its internals to GLib functions, Mahmoud Mandour, 2021/03/19
- [PATCH 7/8] virtiofsd/passthrough_ll.c: Changed local allocations to GLib functions, Mahmoud Mandour, 2021/03/19
- [PATCH 5/8] virtiofsd: Changed allocation of lo_map_elems to GLib's functions, Mahmoud Mandour, 2021/03/19
- [PATCH 8/8] virtiofsd/fuse_virtio.c: Changed allocations of locals to GLib, Mahmoud Mandour, 2021/03/19