diff options
author | Mahmoud Mandour <ma.mandourr@gmail.com> | 2021-03-14 05:23:23 +0200 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2021-05-26 18:39:32 +0100 |
commit | bf99f30bc3420f2f4b82f7f827fb93197d33c017 (patch) | |
tree | a3ab546806bd4c37b52d6427cbc70e0cdc32e748 /tools | |
parent | d14d4f4f1815dcf63fa6b90e9a34854977e42f84 (diff) | |
download | qemu-bf99f30bc3420f2f4b82f7f827fb93197d33c017.zip qemu-bf99f30bc3420f2f4b82f7f827fb93197d33c017.tar.gz qemu-bf99f30bc3420f2f4b82f7f827fb93197d33c017.tar.bz2 |
tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc
Replaced a malloc() call and its respective free() with
GLib's g_try_malloc() and g_free() calls.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
Message-Id: <20210314032324.45142-8-ma.mandourr@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/virtiofsd/fuse_opt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c index f0ab8d2..9d37144 100644 --- a/tools/virtiofsd/fuse_opt.c +++ b/tools/virtiofsd/fuse_opt.c @@ -272,7 +272,7 @@ static int process_opt_sep_arg(struct fuse_opt_context *ctx, } param = ctx->argv[ctx->argctr]; - newarg = malloc(sep + strlen(param) + 1); + newarg = g_try_malloc(sep + strlen(param) + 1); if (!newarg) { return alloc_failed(); } @@ -280,7 +280,7 @@ static int process_opt_sep_arg(struct fuse_opt_context *ctx, memcpy(newarg, arg, sep); strcpy(newarg + sep, param); res = process_opt(ctx, opt, sep, newarg, iso); - free(newarg); + g_free(newarg); return res; } |