]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-fuse: always free allocated fuse_args
authorKefu Chai <kchai@redhat.com>
Mon, 13 Feb 2017 14:26:42 +0000 (22:26 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 13 Feb 2017 14:35:30 +0000 (22:35 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph_fuse.cc

index a2d7287c9a449035c10d7db02b4243669eb51d64..d4e0d0818c02bc0b4b2ce1a20ff0404ebfcea767 100644 (file)
@@ -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 <<