From: Luis Alves Date: Sun, 11 Nov 2018 11:46:28 +0000 (+0000) Subject: cclient: fix crash on cc_remove_card X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=203c003315d48accf3251c96dbbd11a40c9ee2a9;p=thirdparty%2Ftvheadend.git cclient: fix crash on cc_remove_card --- diff --git a/src/descrambler/cclient.c b/src/descrambler/cclient.c index ee5a3a36e..b370a1575 100644 --- a/src/descrambler/cclient.c +++ b/src/descrambler/cclient.c @@ -229,7 +229,7 @@ cc_remove_card(cclient_t *cc, cc_card_data_t *pcard) cc_get_card_name(pcard, buf, sizeof(buf))); /* invalidate all requests */ - LIST_FOREACH(ct, &cc->cc_services, cs_link) + LIST_FOREACH(ct, &cc->cc_services, cs_link) { for (ep = LIST_FIRST(&ct->cs_ecm_pids); ep; ep = epn) { epn = LIST_NEXT(ep, ep_link); for (es = LIST_FIRST(&ep->ep_sections); es; es = esn) { @@ -248,13 +248,13 @@ cc_remove_card(cclient_t *cc, cc_card_data_t *pcard) if (LIST_EMPTY(&ep->ep_sections)) cc_free_ecm_pid(ep); } + if (changed) { + ct->cs_capid = 0xffff; + ct->ecm_state = ECM_INIT; + } + } cc_free_card(pcard); - - if (changed) { - ct->cs_capid = 0xffff; - ct->ecm_state = ECM_INIT; - } } /**