From 50fe9f7c818628dc5dd69218c851a48fa1f07987 Mon Sep 17 00:00:00 2001
From: Bill Zissimopoulos <billziss@navimatics.com>
Date: Thu, 2 Jan 2020 03:08:03 -0800
Subject: [PATCH] Fixed memory leak in fuse_session_new()

---
 ChangeLog.rst       | 2 ++
 lib/fuse_lowlevel.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.rst b/ChangeLog.rst
index 284015d4..a56f854a 100644
--- a/ChangeLog.rst
+++ b/ChangeLog.rst
@@ -1,3 +1,8 @@
+Unreleased Changes
+==================
+
+* Fixed memory leak in fuse_session_new().
+
 libfuse 3.9.0 (2019-12-14)
 ==========================
 
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 36713854..d8112f58 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -2975,7 +2975,8 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
 out4:
 	fuse_opt_free_args(args);
 out3:
-	free(mo);
+	if (mo != NULL)
+		destroy_mount_opts(mo);
 out2:
 	free(se);
 out1:
