krb5: Fix warnings

This commit is contained in:
Nicolas Williams
2021-03-28 17:51:12 -05:00
parent 82a8744787
commit fb553dde1d
28 changed files with 166 additions and 106 deletions

View File

@@ -1044,5 +1044,24 @@ extern KRB5_LIB_VARIABLE const char *krb5_cc_type_scc;
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_dcc;
extern KRB5_LIB_VARIABLE const char *krb5_cc_type_keyring;
/* clang analyzer workarounds */
#ifdef __clang_analyzer__
/*
* The clang analyzer (lint) can't know that krb5_enomem() always returns
* non-zero, so code like:
*
* if ((x = malloc(...)) == NULL)
* ret = krb5_enomem(context)
* if (ret == 0)
* *x = ...;
*
* causes false positives.
*
* The fix is to make krb5_enomem() a macro that always evaluates to ENOMEM.
*/
#define krb5_enomem(c) (krb5_enomem(c), ENOMEM)
#endif
#endif /* __KRB5_H__ */