ipa-enrollment: fix memory leaks

`smods`, `fqdn`, `sdn` were not freed.

Related: https://pagure.io/freeipa/issue/9895
Signed-off-by: Viktor Ashirov <vashirov@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Alexander Bokovoy <abbra@users.noreply.github.com>
This commit is contained in:
Viktor Ashirov
2025-12-12 09:40:21 +01:00
committed by Florence Blanc-Renaud
parent 4a62d6141a
commit bfc9552d56
@@ -137,7 +137,7 @@ ipa_join(Slapi_PBlock *pb)
int is_root=0;
char *krbLastPwdChange = NULL;
char *fqdn = NULL;
Slapi_Mods *smods;
Slapi_Mods *smods = NULL;
char *attrlist[] = {"fqdn", "krbPrincipalKey", "krbLastPwdChange", "krbPrincipalName", NULL };
char * filter;
@@ -329,8 +329,13 @@ free_and_return:
if (pbtm) {
slapi_pblock_destroy(pbtm);
}
if (smods) {
slapi_mods_free(&smods);
}
if (krbLastPwdChange) slapi_ch_free_string(&krbLastPwdChange);
if (fqdn) slapi_ch_free_string(&fqdn);
if (sdn) slapi_sdn_free(&sdn);
LOG("%s", errMesg ? errMesg : "success\n");
slapi_send_ldap_result(pb, rc, NULL, errMesg, 0, NULL);