]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epggrab: ota - fix memory leak
authorJaroslav Kysela <perex@perex.cz>
Fri, 4 Jul 2014 09:44:22 +0000 (11:44 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 7 Jul 2014 14:41:53 +0000 (16:41 +0200)
src/epggrab/otamux.c

index b0a48d9ae0ec64bf03911032474cd5494b7bfb8e..56bd589137fdff53cbdeba979164ebc151408086 100644 (file)
@@ -661,7 +661,9 @@ epggrab_ota_free ( epggrab_ota_head_t *head, epggrab_ota_mux_t *ota  )
   epggrab_ota_map_t *map;
   epggrab_ota_svc_link_t *svcl;
 
-  TAILQ_REMOVE(head, ota, om_q_link);
+  if (head != NULL)
+    TAILQ_REMOVE(head, ota, om_q_link);
+  RB_REMOVE(&epggrab_ota_all, ota, om_global_link);
   while ((map = LIST_FIRST(&ota->om_modules)) != NULL) {
     LIST_REMOVE(map, om_link);
     while ((svcl = RB_FIRST(&map->om_svcs)) != NULL)
@@ -682,6 +684,8 @@ epggrab_ota_shutdown ( void )
     epggrab_ota_free(&epggrab_ota_active, ota);
   while ((ota = TAILQ_FIRST(&epggrab_ota_pending)) != NULL)
     epggrab_ota_free(&epggrab_ota_pending, ota);
+  while ((ota = RB_FIRST(&epggrab_ota_all)) != NULL)
+    epggrab_ota_free(NULL, ota);
   pthread_mutex_unlock(&global_lock);
   SKEL_FREE(epggrab_ota_mux_skel);
   SKEL_FREE(epggrab_svc_link_skel);