summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-12-13 12:00:41 -0500
committerGreg Hudson <ghudson@mit.edu>2013-12-16 11:39:41 -0500
commit1cda48a7ed4069cfc052f974ec3d76a9137c8c5a (patch)
tree4c5d181c18d451dc57cdacc5fc419da7a4213286
parent1249c75810e3d5c33ba723c65a904ee914ca8048 (diff)
downloadkrb5-1cda48a7ed4069cfc052f974ec3d76a9137c8c5a.tar.gz
krb5-1cda48a7ed4069cfc052f974ec3d76a9137c8c5a.tar.xz
krb5-1cda48a7ed4069cfc052f974ec3d76a9137c8c5a.zip
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@mit.edu: clarified commit message] ticket: 7803 (new) target_version: 1.12.1 tags: pullup
-rw-r--r--src/lib/gssapi/spnego/spnego_mech.c1
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 818a1b4439..06cfab00f8 100644
--- a/src/lib/gssapi/spnego/spnego_mech.c
+++ b/src/lib/gssapi/spnego/spnego_mech.c
@@ -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)