From: Flole998 Date: Sun, 21 Feb 2021 01:22:52 +0000 (+0100) Subject: Several coverity fixes, year updated, map muxes between DVB Types X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f0c4f298b1e176cf995b8bcd10fd05c425d3a4f;p=thirdparty%2Ftvheadend.git Several coverity fixes, year updated, map muxes between DVB Types * Fix potential double-free * Add Option to Map Muxes between different DVB-Types * Fix potential endless loop in RTSP code * Change years from 2020 * Rewrite scanfile.c for dynamic memory allocation * More coverity fixes --- diff --git a/src/api/api_epg.c b/src/api/api_epg.c index f7b38c301..468475cc3 100644 --- a/src/api/api_epg.c +++ b/src/api/api_epg.c @@ -565,7 +565,8 @@ api_epg_episode_sorted(const struct epg_set *set, } } - tvh_qsort_r(bcast_entries, num_entries, sizeof(bcast_entry_t), api_epg_sort_by_time_t, 0); + if(bcast_entries != NULL) + tvh_qsort_r(bcast_entries, num_entries, sizeof(bcast_entry_t), api_epg_sort_by_time_t, 0); for (i=0; i 0) { snprintf(buf, sizeof(buf), "pids=%s%s", p[0], _w); - satip_rtsp_play0(hc, index++, stream, buf); + r = satip_rtsp_play0(hc, index++, stream, buf); + if (r < 0) + return r; for (i = 1; i < pcnt; i++) { snprintf(buf, sizeof(buf), "addpids=%s%s", p[i], _w); r = satip_rtsp_play0(hc, index++, stream, buf); diff --git a/src/input/mpegts/scanfile.c b/src/input/mpegts/scanfile.c index 8ffa55572..6addef6f1 100644 --- a/src/input/mpegts/scanfile.c +++ b/src/input/mpegts/scanfile.c @@ -353,8 +353,10 @@ scanfile_create_network str++; } } - if (!reg) + if (!reg) { + free(buf); return -1; + } /* Network */ str = buf; diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c index d60a2e383..bbd2a1e20 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c @@ -154,8 +154,11 @@ tvhdhomerun_device_class_override_notify( void * obj, const char *lang ) htsmsg_t *conf; conf = hts_settings_load("input/tvhdhomerun/adapters/%s", hd->hd_info.uuid); - if (conf) - conf = htsmsg_get_map(conf, "frontends"); + if (conf) { + htsmsg_t *subconf = htsmsg_get_map(conf, "frontends"); + htsmsg_destroy(conf); + conf = subconf; + } lock_assert(&global_lock); diff --git a/src/parsers/parsers.c b/src/parsers/parsers.c index 304ee800b..231501e39 100644 --- a/src/parsers/parsers.c +++ b/src/parsers/parsers.c @@ -101,8 +101,8 @@ static void parser_rstlog(parser_t *t, th_pkt_t *pkt) { streaming_message_t *sm = streaming_msg_create_pkt(pkt); - pkt_ref_dec(pkt); /* streaming_msg_create_pkt increses ref counter */ streaming_message_t *clone = streaming_msg_clone(sm); + streaming_msg_free(sm); TAILQ_INSERT_TAIL (&t->prs_rstlog, clone, sm_link); }