From: Luke Howard Date: Mon, 20 Sep 2010 14:41:33 +0000 (+0200) Subject: Cleanup provider immediately if initialisation fails X-Git-Url: http://www.project-moonshot.org/gitweb/?p=cyrus-sasl.git;a=commitdiff_plain;h=b31a59e62e123fa8d1350d4b387a0ca687d4fc45 Cleanup provider immediately if initialisation fails --- diff --git a/mech_eap/util_attr.cpp b/mech_eap/util_attr.cpp index 0fe8d17..2e92acc 100644 --- a/mech_eap/util_attr.cpp +++ b/mech_eap/util_attr.cpp @@ -137,8 +137,11 @@ gss_eap_attr_ctx::initFromExistingContext(const gss_eap_attr_ctx *manager) ret = provider->initFromExistingContext(this, manager->m_providers[i]); - if (ret == false) + if (ret == false) { + delete provider; + m_providers[i] = NULL; break; + } } return ret; @@ -160,8 +163,11 @@ gss_eap_attr_ctx::initFromGssContext(const gss_cred_id_t cred, continue; ret = provider->initFromGssContext(this, cred, ctx); - if (ret == false) + if (ret == false) { + delete provider; + m_providers[i] = NULL; break; + } } return ret; @@ -189,8 +195,11 @@ gss_eap_attr_ctx::initFromBuffer(const gss_buffer_t buffer) ret = provider->initFromGssContext(this, GSS_C_NO_CREDENTIAL, GSS_C_NO_CONTEXT); - if (ret == false) + if (ret == false) { + delete provider; + m_providers[i] = NULL; break; + } } return ret;