mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix memleak and silence Coverity defects
Some of these are not real defects, because we are guaranteed to have valid context in some functions, and checks are not necessary. I added the checks anyway in order to silence Coverity on these issues. One meleak on error condition was fixed in daemons/ipa-kdb/ipa_kdb_pwdpolicy.c Silence errors in ipa-client/ipa-getkeytab.c, the code looks wrong, but it is actually fine as we count before hand so we never actually use the wrong value that is computed on the last pass when p == 0 Fixes: https://fedorahosted.org/freeipa/ticket/2488
This commit is contained in:
parent
19b2af8e52
commit
735618a1c6
@ -71,6 +71,9 @@ static krb5_error_code ipadb_check_pw_policy(krb5_context context,
|
||||
int ret;
|
||||
|
||||
ipactx = ipadb_get_context(context);
|
||||
if (!ipactx) {
|
||||
return KRB5_KDB_DBNOTINITED;
|
||||
}
|
||||
|
||||
ied = (struct ipadb_e_data *)db_entry->e_data;
|
||||
if (ied->magic != IPA_E_DATA_MAGIC) {
|
||||
|
@ -373,6 +373,9 @@ static krb5_error_code ipadb_parse_ldap_entry(krb5_context kcontext,
|
||||
/* proceed to fill in attributes in the order they are defined in
|
||||
* krb5_db_entry in kdb.h */
|
||||
ipactx = ipadb_get_context(kcontext);
|
||||
if (!ipactx) {
|
||||
return KRB5_KDB_DBNOTINITED;
|
||||
}
|
||||
lcontext = ipactx->lcontext;
|
||||
|
||||
entry->magic = KRB5_KDB_MAGIC_NUMBER;
|
||||
|
@ -121,6 +121,9 @@ krb5_error_code ipadb_get_ipapwd_policy(struct ipadb_context *ipactx,
|
||||
|
||||
done:
|
||||
ldap_msgfree(res);
|
||||
if (kerr) {
|
||||
free(pol);
|
||||
}
|
||||
return kerr;
|
||||
}
|
||||
|
||||
|
@ -211,10 +211,10 @@ static int prep_ksdata(krb5_context krbctx, const char *str,
|
||||
if (krberr != 0) {
|
||||
fprintf(stderr,
|
||||
_("Warning unrecognized encryption type: [%s]\n"), t);
|
||||
t = p+1;
|
||||
if (p) t = p + 1;
|
||||
continue;
|
||||
}
|
||||
t = p+1;
|
||||
if (p) t = p + 1;
|
||||
|
||||
if (!q) {
|
||||
ksdata[j].salttype = KRB5_KDB_SALTTYPE_NORMAL;
|
||||
|
Loading…
Reference in New Issue
Block a user