]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix minor leak when loading GSS mechanisms 987/head
authorGreg Hudson <ghudson@mit.edu>
Wed, 16 Oct 2019 19:16:54 +0000 (15:16 -0400)
committerGreg Hudson <ghudson@mit.edu>
Mon, 21 Oct 2019 21:27:25 +0000 (17:27 -0400)
When gssint_get_mechanism() loads a GSS mech, it must clear errinfo if
krb5int_open_plugin() or krb5int_get_plugin_func() returns an error.

src/lib/gssapi/mechglue/g_initialize.c

index 394869e27a0ffe225cb434fae67faa05de2db27f..0054acf88ed5db93d2204671921f8fb9dfd99fe7 100644 (file)
@@ -1155,6 +1155,7 @@ gssint_get_mechanism(gss_const_OID oid)
 
        if (krb5int_open_plugin(aMech->uLibName, &dl, &errinfo) != 0 ||
            errinfo.code != 0) {
+               k5_clear_error(&errinfo);
                k5_mutex_unlock(&g_mechListLock);
                return ((gss_mechanism)NULL);
        }
@@ -1165,6 +1166,7 @@ gssint_get_mechanism(gss_const_OID oid)
                aMech->mech = (*sym)(aMech->mech_type);
        } else {
                /* Try dynamic dispatch table */
+               k5_clear_error(&errinfo);
                aMech->mech = build_dynamicMech(dl, aMech->mech_type);
                aMech->freeMech = 1;
        }