]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Several coverity fixes, year updated, map muxes between DVB Types
authorFlole998 <Flole998@users.noreply.github.com>
Sun, 21 Feb 2021 01:22:52 +0000 (02:22 +0100)
committerGitHub <noreply@github.com>
Sun, 21 Feb 2021 01:22:52 +0000 (02:22 +0100)
* 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

src/api/api_epg.c
src/config.c
src/input/mpegts/dvb_support.c
src/input/mpegts/satip/satip_rtsp.c
src/input/mpegts/scanfile.c
src/input/mpegts/tvhdhomerun/tvhdhomerun.c
src/parsers/parsers.c

index f7b38c301dab5a305ceff7b375b581b982c95163..468475cc34f763d84b2177aada696237d99d1e96 100644 (file)
@@ -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<num_entries; ++i) {
     htsmsg_t *m = bcast_entries[i].m;
@@ -629,7 +630,7 @@ api_epg_related
   ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
 {
   uint32_t id, entries = 0;
-  htsmsg_t *l = htsmsg_create_list();
+  htsmsg_t *l;
   epg_broadcast_t *e;
   char *lang, *title_esc, *title_anchor;
   epg_set_t *serieslink = NULL;
@@ -638,6 +639,8 @@ api_epg_related
   if (htsmsg_get_u32(args, "eventId", &id))
     return EINVAL;
 
+  l = htsmsg_create_list();
+
   /* Main Job */
   lang = access_get_lang(perm, htsmsg_get_str(args, "lang"));
   tvh_mutex_lock(&global_lock);
index 5e3462f0293bda7a74d14267248e818c0901e34f..1e3933e2a08e0898002b49829c257b9ab9cb01a5 100644 (file)
@@ -374,6 +374,7 @@ config_migrate_v1 ( void )
 
       /* Build entry */
       uuid_set(&chnu, NULL);
+      if(m != NULL) htsmsg_destroy(m);
       m = htsmsg_create_map();
       htsmsg_add_u32(m, "channelid", atoi(htsmsg_field_name(f)));
       htsmsg_add_str(m, "uuid", uuid_get_hex(&chnu, ubufc));
index c0ef536925719c4c4de837909d5c18248e9a2eac..e1718c12014fad50996b5516269167914d29a180 100644 (file)
@@ -338,8 +338,6 @@ dvb_get_string
     break;
 
   case 0x1f: /* Described by encoding_type_id, TS 101 162 */
-    if (srclen < 1)
-      return -1;
     return -1; /* NYI */
 
   default:
index e0f675e48815b738fddaa473c706eb6d9c8b7ff7..f6a376bd19fc8ebce30c9135738a90e729c2add1 100644 (file)
@@ -369,7 +369,9 @@ satip_rtsp_play( http_client_t *hc, const char *pids,
   /* do the proper split */
   if (pcnt > 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);
index 8ffa55572996a51615e9d58a9538e0759481a231..6addef6f1fd311778a818ee74366f99f297440c1 100644 (file)
@@ -353,8 +353,10 @@ scanfile_create_network
       str++;
     }
   }
-  if (!reg)
+  if (!reg) {
+    free(buf);
     return -1;
+  }
 
   /* Network */
   str = buf;
index d60a2e38376ae3027c048de61343ea4a13624e32..bbd2a1e206b1a7e461ff1746f652145c20b1b2ad 100644 (file)
@@ -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);
 
index 304ee800bce916153d1a9d695dd12cb64c1eac46..231501e39f97e5dda26f43dbefd415caa4188faf 100644 (file)
@@ -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);
 }