krb5 commit: Fix leak on GSS module symbol resolution error

Greg Hudson ghudson at MIT.EDU
Mon Jul 21 00:46:13 EDT 2014


https://github.com/krb5/krb5/commit/53362ba69fb5a60386dd358c3450bfcf4f6b7346
commit 53362ba69fb5a60386dd358c3450bfcf4f6b7346
Author: Simo Sorce <simo at redhat.com>
Date:   Thu Jul 10 10:04:06 2014 -0400

    Fix leak on GSS module symbol resolution error
    
    If krb5int_get_plugin_func fails, errinfo may contain an allocated
    error message.  Free it on error when loading GSS modules.
    
    [ghudson at mit.edu: also fix GSS_ADD_DYNAMIC_METHOD; clarify commit
    message]
    
    ticket: 7966 (new)
    target_version: 1.12.2
    tags: pullup

 src/lib/gssapi/mechglue/g_initialize.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lib/gssapi/mechglue/g_initialize.c b/src/lib/gssapi/mechglue/g_initialize.c
index b0eb40a..04ba879 100644
--- a/src/lib/gssapi/mechglue/g_initialize.c
+++ b/src/lib/gssapi/mechglue/g_initialize.c
@@ -614,8 +614,10 @@ gssint_register_mechinfo(gss_mech_info template)
 		if (krb5int_get_plugin_func(_dl, \
 					    #_symbol, \
 					    (void (**)())&(_mech)->_symbol, \
-					    &errinfo) || errinfo.code) \
+					    &errinfo) || errinfo.code) {  \
 			(_mech)->_symbol = NULL; \
+			k5_clear_error(&errinfo); \
+			} \
 	} while (0)
 
 /*
@@ -727,8 +729,10 @@ build_dynamicMech(void *dl, const gss_OID mech_type)
 					    "gssi" #_nsym,		\
 					    (void (**)())&(_mech)->_psym \
 					    ## _nsym,			\
-					    &errinfo) || errinfo.code)	\
+					    &errinfo) || errinfo.code) { \
 			(_mech)->_psym ## _nsym = NULL;			\
+			k5_clear_error(&errinfo);			\
+		}							\
 	} while (0)
 
 /* Build an interposer mechanism function table from dl. */


More information about the cvs-krb5 mailing list