]> 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)
committerGreg Hudson <ghudson@mit.edu>
Mon, 21 Jul 2014 03:38:37 +0000 (23:38 -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]

ticket: 7966 (new)
target_version: 1.12.2
tags: pullup

src/lib/gssapi/mechglue/g_initialize.c

index b0eb40a5721576cb07ce1dd2b7c62c765e238b99..04ba87958c3c5172d03504564053e9380caf4ead 100644 (file)
@@ -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. */