krb5 commit [krb5-1.12]: Fix leak on GSS module symbol resolution error

Tom Yu tlyu at MIT.EDU
Mon Jul 21 18:33:45 EDT 2014


https://github.com/krb5/krb5/commit/f7a9d09b097bcc1f890e0f9a55f9cf812b29226d
commit f7a9d09b097bcc1f890e0f9a55f9cf812b29226d
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]
    
    (cherry picked from commit 53362ba69fb5a60386dd358c3450bfcf4f6b7346)
    
    ticket: 7966
    version_fixed: 1.12.2
    status: resolved

 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 50e37e1..68aa7a7 100644
--- a/src/lib/gssapi/mechglue/g_initialize.c
+++ b/src/lib/gssapi/mechglue/g_initialize.c
@@ -591,8 +591,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)
 
 /*
@@ -704,8 +706,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