From: Jaroslav Kysela Date: Thu, 28 May 2015 11:30:07 +0000 (+0200) Subject: epggrab: eit/opentv - try to rule out another wrong memory access on shutdown X-Git-Tag: v4.2.1~2435 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a964b5265d5b129c3867721cac6d4b879d254fe6;p=thirdparty%2Ftvheadend.git epggrab: eit/opentv - try to rule out another wrong memory access on shutdown --- diff --git a/src/epggrab.h b/src/epggrab.h index a85d9b226..1e0f41655 100644 --- a/src/epggrab.h +++ b/src/epggrab.h @@ -274,6 +274,7 @@ extern uint32_t epggrab_channel_rename; extern uint32_t epggrab_channel_renumber; extern uint32_t epggrab_channel_reicon; extern uint32_t epggrab_epgdb_periodicsave; +extern int epggrab_ota_running; extern char *epggrab_ota_cron; extern uint32_t epggrab_ota_timeout; extern uint32_t epggrab_ota_initial; diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index e1d5eeecd..d966e29d7 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -579,12 +579,19 @@ _eit_callback uint16_t onid, tsid, sid; uint32_t extraid; mpegts_service_t *svc; - mpegts_mux_t *mm = mt->mt_mux; - epggrab_ota_map_t *map = mt->mt_opaque; - epggrab_module_t *mod = (epggrab_module_t *)map->om_module; + mpegts_mux_t *mm; + epggrab_ota_map_t *map; + epggrab_module_t *mod; epggrab_ota_mux_t *ota = NULL; mpegts_psi_table_state_t *st; + if (!epggrab_ota_running) + return -1; + + mm = mt->mt_mux; + map = mt->mt_opaque; + mod = (epggrab_module_t *)map->om_module; + /* Validate */ if(tableid < 0x4e || tableid > 0x6f || len < 11) return -1; diff --git a/src/epggrab/module/opentv.c b/src/epggrab/module/opentv.c index 371832f40..28308c8c0 100644 --- a/src/epggrab/module/opentv.c +++ b/src/epggrab/module/opentv.c @@ -541,9 +541,15 @@ opentv_table_callback int r = 1, cid, mjd; int sect, last, ver; mpegts_psi_table_state_t *st; - opentv_status_t *sta = mt->mt_opaque; - opentv_module_t *mod = sta->os_mod; - epggrab_ota_mux_t *ota = sta->os_ota; + opentv_status_t *sta; + opentv_module_t *mod; + epggrab_ota_mux_t *ota; + + if (!epggrab_ota_running) return -1; + + sta = mt->mt_opaque; + mod = sta->os_mod; + ota = sta->os_ota; /* Validate */ if (len < 7) return -1; @@ -612,11 +618,18 @@ static int opentv_bat_callback ( mpegts_table_t *mt, const uint8_t *buf, int len, int tableid ) { - int *t; - opentv_status_t *sta = mt->mt_opaque; - opentv_module_t *mod = sta->os_mod; - int r = dvb_bat_callback(mt, buf, len, tableid); - epggrab_ota_mux_t *ota = sta->os_ota; + int *t, r; + opentv_status_t *sta; + opentv_module_t *mod; + epggrab_ota_mux_t *ota; + + if (!epggrab_ota_running) return -1; + + sta = mt->mt_opaque; + mod = sta->os_mod; + ota = sta->os_ota; + + r = dvb_bat_callback(mt, buf, len, tableid); /* Register */ if (!ota) {