From: David Disseldorp Date: Wed, 8 Feb 2017 16:11:30 +0000 (+0100) Subject: vfs_ceph: cleanup mount handle on failure X-Git-Tag: talloc-2.1.9~149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=667fb18f1ecc97832832a1f9cedc044d004f1929;p=thirdparty%2Fsamba.git vfs_ceph: cleanup mount handle on failure Signed-off-by: David Disseldorp Reviewed-by: Ralph Böhme --- 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.