]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix memory leak in SPNEGO initiator
authorSimo Sorce <simo@redhat.com>
Fri, 13 Dec 2013 17:00:41 +0000 (12:00 -0500)
committerGreg Hudson <ghudson@mit.edu>
Mon, 16 Dec 2013 16:39:41 +0000 (11:39 -0500)
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@mit.edu: clarified commit message]

ticket: 7803 (new)
target_version: 1.12.1
tags: pullup

src/lib/gssapi/spnego/spnego_mech.c

index 818a1b4439f50abebe80e6abb244ad51d59fc701..06cfab00f852c70bd7351d6017167f256a5552da 100644 (file)
@@ -890,6 +890,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)