From 36878000edbe669166e860013c924837280e86c0 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 13 Feb 2017 22:26:42 +0800 Subject: [PATCH] ceph-fuse: always free allocated fuse_args Signed-off-by: Kefu Chai --- src/ceph_fuse.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index a2d7287c9a449..d4e0d0818c02b 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -47,18 +47,18 @@ using namespace std; static void fuse_usage() { - const char **argv = (const char **) malloc((2) * sizeof(char *)); - argv[0] = "ceph-fuse"; - argv[1] = "-h"; + const char* argv[] = { + "ceph-fuse", + "-h", + }; struct fuse_args args = FUSE_ARGS_INIT(2, (char**)argv); if (fuse_parse_cmdline(&args, NULL, NULL, NULL) == -1) { derr << "fuse_parse_cmdline failed." << dendl; - fuse_opt_free_args(&args); } - - assert(args.allocated); // Checking fuse has realloc'd args so we can free newargv - free(argv); + assert(args.allocated); + fuse_opt_free_args(&args); } + void usage() { cout << -- 2.47.3