diff --git a/src/providers/krb5/krb5_delayed_online_authentication.c b/src/providers/krb5/krb5_delayed_online_authentication.c index 1fac986a62..7f49e2e597 100644 --- a/src/providers/krb5/krb5_delayed_online_authentication.c +++ b/src/providers/krb5/krb5_delayed_online_authentication.c @@ -160,6 +160,7 @@ static errno_t authenticate_stored_users( iter = new_hash_iter_context(deferred_auth_ctx->user_table); if (iter == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "new_hash_iter_context failed.\n"); + hash_destroy(uid_table); return EINVAL; } @@ -205,6 +206,7 @@ static errno_t authenticate_stored_users( } talloc_free(iter); + hash_destroy(uid_table); return EOK; } diff --git a/src/util/find_uid.c b/src/util/find_uid.c index ddbab4ab96..eedbe58283 100644 --- a/src/util/find_uid.c +++ b/src/util/find_uid.c @@ -422,7 +422,13 @@ errno_t get_uid_table(TALLOC_CTX *mem_ctx, hash_table_t **table) return ENOMEM; } - return get_active_uid(*table, 0); + ret = get_active_uid(*table, 0); + if (ret != EOK) { + hash_destroy(*table); + *table = NULL; + } + + return ret; } errno_t check_if_uid_is_active(uid_t uid, bool *result)