]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
linuxdvb: ensure satconf memory is cleaned up properly
authorAdam Sutton <dev@adamsutton.me.uk>
Sat, 11 Jan 2014 00:43:59 +0000 (00:43 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Sat, 11 Jan 2014 00:43:59 +0000 (00:43 +0000)
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/linuxdvb/linuxdvb_private.h
src/input/mpegts/linuxdvb/linuxdvb_satconf.c

index 6a10a678d131e7934d96211adc5a0381d1b89355..908b3f45de3a4552b122f90941ec51d726e397cd 100644 (file)
@@ -183,7 +183,7 @@ linuxdvb_frontend_dvbs_class_satconf_set ( void *self, const void *str )
   linuxdvb_frontend_t *lfe = self;
   if (lfe->lfe_satconf && !strcmp(str ?: "", lfe->lfe_satconf->ls_type))
     return 0;
-  linuxdvb_satconf_delete(lfe->lfe_satconf);
+  linuxdvb_satconf_delete(lfe->lfe_satconf, 1);
   lfe->lfe_satconf = linuxdvb_satconf_create(lfe, str, NULL, NULL);
   return 1;
 }
@@ -1034,7 +1034,7 @@ linuxdvb_frontend_delete ( linuxdvb_frontend_t *lfe )
 
   /* Delete satconf */
   if (lfe->lfe_satconf)
-    linuxdvb_satconf_delete(lfe->lfe_satconf);
+    linuxdvb_satconf_delete(lfe->lfe_satconf, 0);
 
   /* Finish */
   mpegts_input_delete((mpegts_input_t*)lfe);
index 72845e32d8d94e4f4ed8d58722ce5bd225a09151..0b37f977c28877da9665252fe5923ac712f331c8 100644 (file)
@@ -303,6 +303,6 @@ linuxdvb_satconf_t *linuxdvb_satconf_create
   ( linuxdvb_frontend_t *lfe,
     const char *type, const char *uuid, htsmsg_t *conf );
 
-void linuxdvb_satconf_delete ( linuxdvb_satconf_t *ls );
+void linuxdvb_satconf_delete ( linuxdvb_satconf_t *ls, int delconf );
 
 #endif /* __TVH_LINUXDVB_PRIVATE_H__ */
index 72b34a8f3266b962fd36406f4011e09df569c2e2..d376621e2d11aa7e99789b54333caf2a2b139edc 100644 (file)
@@ -630,12 +630,6 @@ linuxdvb_satconf_ele_class_get_childs ( idnode_t *o )
   return is;
 }
 
-static void
-linuxdvb_satconf_ele_class_delete ( idnode_t *in )
-{
-  //TODO:linuxdvb_satconf_ele_delete((linuxdvb_satconf_ele_t*)in);
-}
-
 static void
 linuxdvb_satconf_ele_class_save ( idnode_t *in )
 {
@@ -651,7 +645,6 @@ const idclass_t linuxdvb_satconf_ele_class =
   .ic_get_title  = linuxdvb_satconf_ele_class_get_title,
   .ic_get_childs = linuxdvb_satconf_ele_class_get_childs,
   .ic_save       = linuxdvb_satconf_ele_class_save,
-  .ic_delete     = linuxdvb_satconf_ele_class_delete,
   .ic_properties = (const property_t[]) {
     {
       .type     = PT_STR,
@@ -980,19 +973,24 @@ linuxdvb_satconf_ele_create0
 }
 
 void
-linuxdvb_satconf_delete ( linuxdvb_satconf_t *ls )
+linuxdvb_satconf_delete ( linuxdvb_satconf_t *ls, int delconf )
 {
-#if TODO
+  linuxdvb_satconf_ele_t *lse, *nxt;
   const char *uuid = idnode_uuid_as_str(&ls->ls_id);
-  hts_settings_remove("input/linuxdvb/satconfs/%s", uuid);
-  if (ls->ls_lnb)
-    linuxdvb_lnb_destroy(ls->ls_lnb);
-  if (ls->ls_switch)
-    linuxdvb_switch_destroy(ls->ls_switch);
-  if (ls->ls_rotor)
-    linuxdvb_rotor_destroy(ls->ls_rotor);
-  mpegts_input_delete((mpegts_input_t*)ls);
-#endif
+  if (delconf)
+    hts_settings_remove("input/linuxdvb/satconfs/%s", uuid);
+  gtimer_disarm(&ls->ls_diseqc_timer);
+  for (lse = TAILQ_FIRST(&ls->ls_elements); lse != NULL; lse = nxt) {
+    nxt = TAILQ_NEXT(lse, ls_link);
+    TAILQ_REMOVE(&ls->ls_elements, lse, ls_link);
+    if (lse->ls_lnb)
+      linuxdvb_lnb_destroy(lse->ls_lnb);
+    if (lse->ls_switch)
+      linuxdvb_switch_destroy(lse->ls_switch);
+    if (lse->ls_rotor)
+      linuxdvb_rotor_destroy(lse->ls_rotor);
+    mpegts_input_delete((mpegts_input_t*)lse);
+  }
 }
 
 /******************************************************************************