]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvb_psi: add refcounting for bouquet services
authorJaroslav Kysela <perex@perex.cz>
Tue, 5 Jan 2016 08:27:46 +0000 (09:27 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 5 Jan 2016 09:20:22 +0000 (10:20 +0100)
src/input/mpegts/dvb_psi.c

index afd27673e071901cbaa234c6338940f031662fec..674558b3f9eb6c250bb40c37817c273b5ba40637 100644 (file)
@@ -432,6 +432,7 @@ dvb_bat_find_service( dvb_bat_id_t *bi, mpegts_service_t *s,
   if (!bs) {
     bs = calloc(1, sizeof(*bs));
     bs->svc = s;
+    service_ref((service_t *)s);
     TAILQ_INSERT_TAIL(&bi->services, bs, link);
   }
   if (lcn != UINT_MAX && !bs->lcn_dtag) {
@@ -1017,6 +1018,8 @@ dvb_bat_destroy_lists( mpegts_table_t *mt )
   while ((bi = LIST_FIRST(&b->bats)) != NULL) {
     while ((bs = TAILQ_FIRST(&bi->services)) != NULL) {
       TAILQ_REMOVE(&bi->services, bs, link);
+      if (bs->svc)
+        service_unref((service_t *)bs->svc);
       free(bs);
     }
     while ((fs = TAILQ_FIRST(&bi->fservices)) != NULL) {