From 667fb18f1ecc97832832a1f9cedc044d004f1929 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Wed, 8 Feb 2017 17:11:30 +0100 Subject: [PATCH] vfs_ceph: cleanup mount handle on failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: David Disseldorp Reviewed-by: Ralph Böhme --- source3/modules/vfs_ceph.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 75233ef677f..1cd364269b5 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -111,19 +111,21 @@ static int cephwrap_connect(struct vfs_handle_struct *handle, const char *servi ret = ceph_conf_read_file(cmount, NULL); } - if (ret) - goto err_out; + if (ret) { + goto err_cm_release; + } DBG_DEBUG( "[CEPH] calling: ceph_conf_get\n" ); ret = ceph_conf_get(cmount, "log file", buf, sizeof(buf)); - if (ret < 0) - goto err_out; + if (ret < 0) { + goto err_cm_release; + } DBG_DEBUG("[CEPH] calling: ceph_mount\n"); ret = ceph_mount(cmount, NULL); - if (ret < 0) - goto err_out; - + if (ret < 0) { + goto err_cm_release; + } /* * encode mount context/state into our vfs/connection holding structure @@ -134,6 +136,9 @@ static int cephwrap_connect(struct vfs_handle_struct *handle, const char *servi return 0; +err_cm_release: + ceph_release(cmount); + cmount = NULL; err_out: /* * Handle the error correctly. Ceph returns -errno. -- 2.47.2