#9468 Covscan issues in ipa-4.11
Closed: fixed by sumenon. Opened by frenaud.

Covscan detected the following issues in ipa 4.11:

Missing Initialization

  • Defect type: UNINIT

freeipa-4.11.0/daemons/ipa-otpd/passkey.c:310: var_decl: Declaring variable "ret" without initializer.
freeipa-4.11.0/daemons/ipa-otpd/passkey.c:334: uninit_use_in_call: Using uninitialized value "ret" when calling "otpd_log_err_".

#   332|           sep = strchr(start, ',');
#   333|           if (sep == NULL || sep == start) {
#   334|->             otpd_log_err(ret, "Missing seperator in [%s]", ipa_passkey[c]);
#   335|               continue;
#   336|           }
  • Defect type: UNINIT

freeipa-4.11.0/daemons/ipa-otpd/passkey.c:310: var_decl: Declaring variable "ret" without initializer.
freeipa-4.11.0/daemons/ipa-otpd/passkey.c:328: uninit_use_in_call: Using uninitialized value "ret" when calling "otpd_log_err_".

#   326|       for (c = 0; ipa_passkey[c] != NULL; c++) {
#   327|           if (strncmp(ipa_passkey[c], PK_PREF, strlen(PK_PREF)) != 0) {
#   328|->             otpd_log_err(ret, "Missing prefix in [%s]", ipa_passkey[c]);
#   329|               continue;
#   330|           }

Resource Leaks

  • Defect type: RESOURCE_LEAK

freeipa-4.11.0/daemons/ipa-otpd/passkey.c:687: alloc_fn: Storage is returned from allocation function "calloc".
freeipa-4.11.0/daemons/ipa-otpd/passkey.c:687: var_assign: Assigning: "child_ctx" = storage returned from "calloc(40UL, 1UL)".
freeipa-4.11.0/daemons/ipa-otpd/passkey.c:805: leaked_storage: Variable "child_ctx" going out of scope leaks the storage it points to.

#   803|       }
#   804|   
#   805|->     return ret;
#   806|   }
#   807|   
  • Defect type: RESOURCE_LEAK

freeipa-4.11.0/daemons/ipa-kdb/ipa_kdb_principals.c:1127: alloc_arg: "ipadb_ldap_attr_to_strlist" allocates memory that is stored into "acl_list".
freeipa-4.11.0/daemons/ipa-kdb/ipa_kdb_principals.c:1151: leaked_storage: Variable "acl_list" going out of scope leaks the storage it points to.

#  1149|       }
#  1150|       *kentry = entry;
#  1151|->     return kerr;
#  1152|   }
#  1153|   
  • Defect type: RESOURCE_LEAK

freeipa-4.11.0/daemons/ipa-otpd/passkey.c:687: alloc_fn: Storage is returned from allocation function "calloc".
freeipa-4.11.0/daemons/ipa-otpd/passkey.c:687: var_assign: Assigning: "child_ctx" = storage returned from "calloc(40UL, 1UL)".
freeipa-4.11.0/daemons/ipa-otpd/passkey.c:805: leaked_storage: Variable "child_ctx" going out of scope leaks the storage it points to.

#   803|       }
#   804|   
#   805|->     return ret;
#   806|   }
#   807|   
  • Defect type: RESOURCE_LEAK

freeipa-4.11.0/daemons/ipa-kdb/ipa_kdb_principals.c:1127: alloc_arg: "ipadb_ldap_attr_to_strlist" allocates memory that is stored into "acl_list".
freeipa-4.11.0/daemons/ipa-kdb/ipa_kdb_principals.c:1151: leaked_storage: Variable "acl_list" going out of scope leaks the storage it points to.

#  1149|       }
#  1150|       *kentry = entry;
#  1151|->     return kerr;
#  1152|   }
#  1153|   

The UNINIT is probably not a functional issue as most compilers default values to 0 but it would be good to be explicit.

I think the RESOURCE_LEAK of child_ctx may be a false positive as a callback is set to free the entry.

The RESOURCE_LEAK in ipa_kdb_principals was resolved in 15de71ae61b0f97689bc8cf38256446f3e7922c1

master:

  • 111e0f04bbcffc6b9fcd3c9e15aa56963b6ea42a Fix some issues identified by a static analyzer

ipa-4-12:

  • 777f4c0ed631f70b64f6a972e7e6cb140155ef1f Fix some issues identified by a static analyzer

Metadata Update from @sumenon:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata