From cf19a0f8e3ceafb6fafff6be54fa8cadb2302fbd Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 19 Jan 2022 23:33:44 -0600 Subject: [PATCH] krb5: Context must be optional for error functions We pass a NULL context to error functions in CCAPI (lib/krb5/acache.c) code paths. --- lib/krb5/error_string.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/krb5/error_string.c b/lib/krb5/error_string.c index 0e42f51bc..ed82c6cdc 100644 --- a/lib/krb5/error_string.c +++ b/lib/krb5/error_string.c @@ -98,11 +98,13 @@ krb5_vset_error_message(krb5_context context, krb5_error_code ret, if (context) { const char *msg; - heim_vset_error_message(context->hcontext, ret, fmt, args); - msg = heim_get_error_message(context->hcontext, ret); + heim_vset_error_message(context ? context->hcontext : NULL, ret, fmt, + args); + msg = heim_get_error_message(context ? context->hcontext : NULL, ret); if (msg) { - _krb5_debug(context, 100, "error message: %s: %d", msg, ret); - heim_free_error_message(context->hcontext, msg); + if (context) + _krb5_debug(context, 100, "error message: %s: %d", msg, ret); + heim_free_error_message(context ? context->hcontext : NULL, msg); } } }