From: itsdeepak Date: Mon, 19 Dec 2016 09:26:40 +0000 (+0530) Subject: Memory leak fixed in file : mount_bsd.c X-Git-Tag: fuse-3.0.1~44 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=845ecf09056db39155760723cc115a5fd1184b05;p=qemu-gpiodev%2Flibfuse.git Memory leak fixed in file : mount_bsd.c --- 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);