From d0fa95101d9add0ac6e40b31e8a0ac2d9238f648 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 4 Jul 2014 11:44:22 +0200 Subject: [PATCH] epggrab: ota - fix memory leak --- src/epggrab/otamux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/epggrab/otamux.c b/src/epggrab/otamux.c index b0a48d9a..56bd5891 100644 --- a/src/epggrab/otamux.c +++ b/src/epggrab/otamux.c @@ -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);