Skip to content
Snippets Groups Projects
Commit bf99f30b authored by Mahmoud Mandour's avatar Mahmoud Mandour Committed by Dr. David Alan Gilbert
Browse files

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: default avatarMahmoud Mandour <ma.mandourr@gmail.com>
Message-Id: <20210314032324.45142-8-ma.mandourr@gmail.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
parent d14d4f4f
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment