From: Jasmin Jessich Date: Wed, 1 Nov 2017 14:09:27 +0000 (+0100) Subject: Fixed crash on CAM remove X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dae93224124e6c674513dc342bbcc211334c8086;p=thirdparty%2Ftvheadend.git Fixed crash on CAM remove When TVH is terminated with 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 --- diff --git a/src/descrambler/dvbcam.c b/src/descrambler/dvbcam.c index e827dc285..a9c14f822 100644 --- a/src/descrambler/dvbcam.c +++ b/src/descrambler/dvbcam.c @@ -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; }