]> 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)
committerTom Yu <tlyu@mit.edu>
Thu, 23 Jan 2014 03:21:24 +0000 (22:21 -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]

(cherry picked from commit 1cda48a7ed4069cfc052f974ec3d76a9137c8c5a)

ticket: 7843 (new)
version_fixed: 1.10.8
status: resolved

src/lib/gssapi/spnego/spnego_mech.c

index f26db635a8494d104c5662ae431b9d00955a5c75..4f8e13d44b595fbe7111495692c97f25e4f035a8 100644 (file)
@@ -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)