]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix leak on GSS module symbol resolution error
authorSimo Sorce <simo@redhat.com>
Thu, 10 Jul 2014 14:04:06 +0000 (10:04 -0400)
committerTom Yu <tlyu@mit.edu>
Mon, 21 Jul 2014 22:21:57 +0000 (18:21 -0400)
If krb5int_get_plugin_func fails, errinfo may contain an allocated
error message.  Free it on error when loading GSS modules.

[ghudson@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

index 50e37e13c2e14898e11d78144ff8ad8f7c8ea572..68aa7a7aa9406c3539009b4de82937165f01623d 100644 (file)
@@ -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. */