krb5 commit [krb5-1.10]: Fix memory leak in SPNEGO initiator

Tom Yu tlyu at MIT.EDU
Wed Jan 22 22:37:59 EST 2014


https://github.com/krb5/krb5/commit/38ad045d2b0c3418b10cd9f252f61aac2d54c1c7
commit 38ad045d2b0c3418b10cd9f252f61aac2d54c1c7
Author: Simo Sorce <simo at redhat.com>
Date:   Fri Dec 13 12:00:41 2013 -0500

    Fix memory leak in SPNEGO initiator
    
    If we eliminate a mechanism from the initiator list because
    gss_init_sec_context fails, free the memory for that mech OID before
    removing it from the list.
    
    [ghudson at mit.edu: clarified commit message]
    
    (cherry picked from commit 1cda48a7ed4069cfc052f974ec3d76a9137c8c5a)
    
    ticket: 7843 (new)
    version_fixed: 1.10.8
    status: resolved

 src/lib/gssapi/spnego/spnego_mech.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/lib/gssapi/spnego/spnego_mech.c b/src/lib/gssapi/spnego/spnego_mech.c
index f26db63..4f8e13d 100644
--- a/src/lib/gssapi/spnego/spnego_mech.c
+++ b/src/lib/gssapi/spnego/spnego_mech.c
@@ -886,6 +886,7 @@ init_ctx_call_init(OM_uint32 *minor_status,
 	 * can do this with recursion.  If all mechanisms produce errors, the
 	 * caller should get the error from the first mech in the list.
 	 */
+	gssalloc_free(sc->mech_set->elements->elements);
 	memmove(sc->mech_set->elements, sc->mech_set->elements + 1,
 		--sc->mech_set->count * sizeof(*sc->mech_set->elements));
 	if (sc->mech_set->count == 0)


More information about the cvs-krb5 mailing list