#8131 covscan memory leaks report
Closed: fixed 4 years ago by cheimes. Opened 4 years ago by abbra.

After running Red Hat's covscan tool, following issues were found:

Error: RESOURCE_LEAK (CWE-772):

freeipa-4.8.3/util/ipa_pwd_ntlm.c:63: alloc_fn: Storage is returned from allocation function "calloc".
freeipa-4.8.3/util/ipa_pwd_ntlm.c:63: var_assign: Assigning: "ucs2Passwd" = storage returned from "calloc(ol, 1UL)".
freeipa-4.8.3/util/ipa_pwd_ntlm.c:71: var_assign: Assigning: "outc" = "ucs2Passwd".
freeipa-4.8.3/util/ipa_pwd_ntlm.c:92: noescape: Resource "ucs2Passwd" is not freed or pointed-to in "MD4_Update".
freeipa-4.8.3/util/ipa_pwd_ntlm.c:108: leaked_storage: Variable "ucs2Passwd" going out of scope leaks the storage it points to.
freeipa-4.8.3/util/ipa_pwd_ntlm.c:108: leaked_storage: Variable "outc" going out of scope leaks the storage it points to.
#  106|   
#  107|   done:
#  108|->     return ret;
#  109|   }

Error: RESOURCE_LEAK (CWE-772):

freeipa-4.8.3/client/ipa-getkeytab.c:513: alloc_arg: "ipa_string_to_enctypes" allocates memory that is stored into "es".
freeipa-4.8.3/client/ipa-getkeytab.c:515: leaked_storage: Variable "es" going out of scope leaks the storage it points to.
#  513|           ret = ipa_string_to_enctypes(enctypes, &es, &num_es, err_msg);
#  514|           if (ret || num_es == 0) {
#  515|->             return LDAP_OPERATIONS_ERROR;
#  516|           }
#  517|       }

Metadata Update from @abbra:
- Issue assigned to abbra

4 years ago

Metadata Update from @frenaud:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1777920

4 years ago

master:

  • e3ad785 covscan: free encryption types in case there is an error
  • e9dd757 covscan: free ucs2-encoded password copy when generating NTLM hash

ipa-4-8:

  • 84592e3 covscan: free encryption types in case there is an error
  • eebabb5 covscan: free ucs2-encoded password copy when generating NTLM hash

ipa-4-7:

  • 212e86e covscan: free encryption types in case there is an error
  • c370815 covscan: free ucs2-encoded password copy when generating NTLM hash

ipa-4-6:

  • e8983f6 covscan: free encryption types in case there is an error
  • 830466c covscan: free ucs2-encoded password copy when generating NTLM hash

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

4 years ago

Login to comment on this ticket.

Metadata