]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fixed crash on CAM remove
authorJasmin Jessich <jasmin@anw.at>
Wed, 1 Nov 2017 14:09:27 +0000 (15:09 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 1 Nov 2017 15:32:15 +0000 (16:32 +0100)
When TVH is terminated with <cntrl-c> and there is a CAM opened,
dvbcam_unregister_cam is executed prior to dvbcam_service_destroy.
dvbcam_unregister_cam will remove "as->ac" so linuxdvb_ca_enqueue_capmt,
executed in dvbcam_service_destroy will crash.
This should also fix a possible crash (not tested), when removing the
CAM with an active stream.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
src/descrambler/dvbcam.c

index e827dc2850ded7d03befea45583076ecdeb692d8..a9c14f8220ab671852361b6e4f234587344d20bf 100644 (file)
@@ -245,10 +245,11 @@ dvbcam_service_destroy(th_descrambler_t *td)
   pthread_mutex_lock(&dvbcam_mutex);
   ac = as->ac;
   if (as->last_pmt) {
-    linuxdvb_ca_enqueue_capmt(ac->ca, ac->slot, as->last_pmt,
-                              as->last_pmt_len,
-                              CA_LIST_MANAGEMENT_UPDATE,
-                              CA_PMT_CMD_ID_NOT_SELECTED);
+    if (ac)
+      linuxdvb_ca_enqueue_capmt(ac->ca, ac->slot, as->last_pmt,
+                                as->last_pmt_len,
+                                CA_LIST_MANAGEMENT_UPDATE,
+                                CA_PMT_CMD_ID_NOT_SELECTED);
     free(as->last_pmt);
     do_active_programs = 1;
   }