Hello and happy new year.

So this is a quite a small diff which, hopefully, will make lib fuse
slightly better. Indeed, it might exist two small potential memory leaks,
first the memory allocated after parsing command line when it succeeds, the
other the very first option argument in the list. Hope it might finds some
interests.

Kind regards.

Index: fuse.c
===================================================================
RCS file: /cvs/src/lib/libfuse/fuse.c,v
retrieving revision 1.24
diff -u -p -r1.24 fuse.c
--- fuse.c 20 May 2014 13:32:22 -0000 1.24
+++ fuse.c 1 Jan 2015 13:17:02 -0000
@@ -493,5 +493,8 @@ fuse_main(int argc, char **argv, const s
  if (!fuse)
  return (-1);

+ if (mp)
+ free(mp);
+
  return (fuse_loop(fuse));
 }
Index: fuse_opt.c
===================================================================
RCS file: /cvs/src/lib/libfuse/fuse_opt.c,v
retrieving revision 1.11
diff -u -p -r1.11 fuse_opt.c
--- fuse_opt.c 8 Oct 2014 04:50:10 -0000 1.11
+++ fuse_opt.c 1 Jan 2015 13:17:02 -0000
@@ -331,7 +331,7 @@ int
 fuse_opt_insert_arg(struct fuse_args *args, int p, const char *name)
 {
  char **av;
- char *this_arg, *next_arg;
+ char *this_arg, *next_arg, *hold_arg;
  int i;

  if (name == NULL)
@@ -353,6 +353,8 @@ fuse_opt_insert_arg(struct fuse_args *ar
  return (-1);
  }

+ hold_arg = this_arg;
+
  args->argc++;
  args->argv = av;
  for (i = p; i < args->argc; i++) {
@@ -360,6 +362,8 @@ fuse_opt_insert_arg(struct fuse_args *ar
  args->argv[i] = this_arg;
  this_arg = next_arg;
  }
+
+ free(hold_arg);
  return (0);
 }

Reply via email to