BUG/MINOR: ssl/cli: duplicate cleaning code in cli_parse_del_crtlist

Since 23cab33 ("BUG/MINOR: ssl: Clear the ckch instance when deleting a
crt-list line"), LIST_DELETE is done twice, one time in
cli_parse_del_crtlist() and another time in ckch_inst_free().

It could trigger a crash with -DDEBUG_LIST.

This isn't a major problem since the ptr is not freed in the meantime so
it will only trigger with the debug.

This patch removes the LIST_DELETE as well as the loop done on link_ref
which is also don in ckch_inst_free()

Could be backported as far as 2.4. 2.4 version does not have a link_ref
loop.
This commit is contained in:
William Lallemand 2024-02-27 17:22:15 +01:00
parent 8a31783b64
commit bb7af8b2f1

View File

@ -1514,7 +1514,6 @@ static int cli_parse_del_crtlist(char **args, char *payload, struct appctx *appc
list_for_each_entry_safe(inst, inst_s, &entry->ckch_inst, by_crtlist_entry) {
struct sni_ctx *sni, *sni_s;
struct ckch_inst_link_ref *link_ref, *link_ref_s;
HA_RWLOCK_WRLOCK(SNI_LOCK, &inst->bind_conf->sni_lock);
list_for_each_entry_safe(sni, sni_s, &inst->sni_ctx, by_ckch_inst) {
@ -1524,12 +1523,6 @@ static int cli_parse_del_crtlist(char **args, char *payload, struct appctx *appc
free(sni);
}
HA_RWLOCK_WRUNLOCK(SNI_LOCK, &inst->bind_conf->sni_lock);
LIST_DELETE(&inst->by_ckchs);
list_for_each_entry_safe(link_ref, link_ref_s, &inst->cafile_link_refs, list) {
LIST_DELETE(&link_ref->link->list);
LIST_DELETE(&link_ref->list);
free(link_ref);
}
ckch_inst_free(inst);
}