aboutsummaryrefslogtreecommitdiff
path: root/lib/mount_bsd.c
diff options
context:
space:
mode:
authorGravatar itsdeepak <deepak.sn@samsung.com>2016-12-19 14:56:40 +0530
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-12-23 18:35:13 -0800
commit845ecf09056db39155760723cc115a5fd1184b05 (patch)
tree7d87180aecd2a47849d4ca3c168f071c2c3f1eba /lib/mount_bsd.c
parent8e69b19cdc7ca7218f468e7ebd10ac7a4b46c56a (diff)
Memory leak fixed in file : mount_bsd.c
Diffstat (limited to 'lib/mount_bsd.c')
-rw-r--r--lib/mount_bsd.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c
index f0eea6f..5e1ea1d 100644
--- a/lib/mount_bsd.c
+++ b/lib/mount_bsd.c
@@ -255,10 +255,16 @@ mount:
if (pid == 0) {
const char *argv[32];
int a = 0;
-
- if (! fdnam && asprintf(&fdnam, "%d", fd) == -1) {
- perror("fuse: failed to assemble mount arguments");
- exit(1);
+ int ret = -1;
+
+ if (! fdnam)
+ {
+ ret = asprintf(&fdnam, "%d", fd);
+ if(ret == -1)
+ {
+ perror("fuse: failed to assemble mount arguments");
+ exit(1);
+ }
}
argv[a++] = mountprog;
@@ -267,6 +273,10 @@ mount:
argv[a++] = opts;
}
argv[a++] = fdnam;
+
+ if(ret != -1)
+ free(fdnam);
+
argv[a++] = mountpoint;
argv[a++] = NULL;
execvp(mountprog, (char **) argv);