mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-22 15:13:50 -06:00
Fix memory leak in GetKeytabControl asn1 code
https://fedorahosted.org/freeipa/ticket/4713 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
66a42e67f3
commit
d55936756d
@ -77,12 +77,12 @@ bool ipaasn1_enc_getktreply(int kvno, struct keys_container *keys,
|
||||
{
|
||||
GetKeytabControl_t gkctrl = { 0 };
|
||||
bool ret = false;
|
||||
KrbKey_t *KK;
|
||||
|
||||
gkctrl.present = GetKeytabControl_PR_reply;
|
||||
gkctrl.choice.reply.newkvno = kvno;
|
||||
|
||||
for (int i = 0; i < keys->nkeys; i++) {
|
||||
KrbKey_t *KK;
|
||||
KK = calloc(1, sizeof(KrbKey_t));
|
||||
if (!KK) goto done;
|
||||
KK->key.type = keys->ksdata[i].key.enctype;
|
||||
@ -109,9 +109,18 @@ bool ipaasn1_enc_getktreply(int kvno, struct keys_container *keys,
|
||||
}
|
||||
|
||||
ret = encode_GetKeytabControl(&gkctrl, buf, len);
|
||||
KK = NULL;
|
||||
|
||||
done:
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_GetKeytabControl, &gkctrl);
|
||||
if (KK) {
|
||||
free(KK->key.value.buf);
|
||||
if (KK->salt) {
|
||||
free(KK->salt->value.buf);
|
||||
free(KK->salt);
|
||||
}
|
||||
free(KK);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user