krb5 commit: Fix minor leak when loading GSS mechanisms

Greg Hudson <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/d09215c926834d8fa5b4bdb98967bf6c9ff8fda4
commit d09215c926834d8fa5b4bdb98967bf6c9ff8fda4
Author: Greg Hudson <[email protected]>
Date:   Wed Oct 16 15:16:54 2019 -0400

    Fix minor leak when loading GSS mechanisms
    
    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 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/lib/gssapi/mechglue/g_initialize.c b/src/lib/gssapi/mechglue/g_initialize.c
index 394869e..0054acf 100644
--- a/src/lib/gssapi/mechglue/g_initialize.c
+++ b/src/lib/gssapi/mechglue/g_initialize.c
@@ -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;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.