]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
cclient: fix crash on cc_remove_card
authorLuis Alves <ljalvs@gmail.com>
Sun, 11 Nov 2018 11:46:28 +0000 (11:46 +0000)
committerJaroslav Kysela <perex@perex.cz>
Mon, 12 Nov 2018 12:02:04 +0000 (13:02 +0100)
src/descrambler/cclient.c

index ee5a3a36e2c7f32b3b23101143ce3ba4471d15e0..b370a15757ad48a7353c9737cee93f2701bf2613 100644 (file)
@@ -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;
-  }
 }
 
 /**