mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix ressource leak in daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c ipa_cldap_netlogon
The leak happens due to using strndup in a for loop to create a temporary string without freeing it in all cases. See: https://pagure.io/freeipa/issue/7738 Signed-off-by: Thomas Woerner <twoerner@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
parent
389c17c5c6
commit
8e98c72e51
@ -260,6 +260,10 @@ int ipa_cldap_netlogon(struct ipa_cldap_ctx *ctx,
|
|||||||
if (req->kvps.pairs[i].value.bv_val[len-1] == '.') {
|
if (req->kvps.pairs[i].value.bv_val[len-1] == '.') {
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
if (domain != NULL) {
|
||||||
|
free(domain);
|
||||||
|
domain = NULL;
|
||||||
|
}
|
||||||
domain = strndup(req->kvps.pairs[i].value.bv_val, len);
|
domain = strndup(req->kvps.pairs[i].value.bv_val, len);
|
||||||
if (!domain) {
|
if (!domain) {
|
||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user