krb5: allow NULL authenticator in krb5_auth_con_free()
authorLuke Howard <lukeh@padl.com>
Tue, 14 Apr 2020 02:37:56 +0000 (12:37 +1000)
committerLuke Howard <lukeh@padl.com>
Wed, 15 Apr 2020 06:23:02 +0000 (16:23 +1000)
When freeing an auth context, allow the authenticator to be NULL. Useful for
freeing partially allocated authentication context.

lib/krb5/auth_context.c

index 4473a442191d508743591270bc826ffd69be9583..43c762b7699b2521dc240aafab085ce53b5f0e22 100644 (file)
@@ -86,7 +86,8 @@ krb5_auth_con_free(krb5_context context,
                   krb5_auth_context auth_context)
 {
     if (auth_context != NULL) {
-       krb5_free_authenticator(context, &auth_context->authenticator);
+       if (auth_context->authenticator)
+           krb5_free_authenticator(context, &auth_context->authenticator);
        if(auth_context->local_address){
            free_HostAddress(auth_context->local_address);
            free(auth_context->local_address);