* [PATCH] virtiofsd: Changed allocations of fuse_session to GLib's functions
@ 2021-03-24 6:49 Mahmoud Mandour
2021-03-31 14:30 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Mahmoud Mandour @ 2021-03-24 6:49 UTC (permalink / raw)
To: qemu-devel; +Cc: Mahmoud Mandour, Dr. David Alan Gilbert, Stefan Hajnoczi
Replaced the allocation and deallocation of fuse_session structs
from calloc() and free() calls to g_try_new0() and g_free().
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
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 1aa26c6333..54e401f074 100644
--- a/tools/virtiofsd/fuse_lowlevel.c
+++ b/tools/virtiofsd/fuse_lowlevel.c
@@ -2476,7 +2476,7 @@ void fuse_session_destroy(struct fuse_session *se)
free(se->vu_socket_path);
se->vu_socket_path = NULL;
- free(se);
+ g_free(se);
}
@@ -2499,7 +2499,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
return NULL;
}
- se = (struct fuse_session *)calloc(1, sizeof(struct fuse_session));
+ se = g_try_new0(struct fuse_session, 1);
if (se == NULL) {
fuse_log(FUSE_LOG_ERR, "fuse: failed to allocate fuse object\n");
goto out1;
@@ -2559,7 +2559,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
out4:
fuse_opt_free_args(args);
out2:
- free(se);
+ g_free(se);
out1:
return NULL;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] virtiofsd: Changed allocations of fuse_session to GLib's functions
2021-03-24 6:49 [PATCH] virtiofsd: Changed allocations of fuse_session to GLib's functions Mahmoud Mandour
@ 2021-03-31 14:30 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2021-03-31 14:30 UTC (permalink / raw)
To: Mahmoud Mandour; +Cc: qemu-devel, Dr. David Alan Gilbert
[-- Attachment #1: Type: text/plain, Size: 420 bytes --]
On Wed, Mar 24, 2021 at 08:49:43AM +0200, Mahmoud Mandour wrote:
> Replaced the allocation and deallocation of fuse_session structs
> from calloc() and free() calls to g_try_new0() and g_free().
>
> Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
> ---
> tools/virtiofsd/fuse_lowlevel.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-31 14:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 6:49 [PATCH] virtiofsd: Changed allocations of fuse_session to GLib's functions Mahmoud Mandour
2021-03-31 14:30 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).