]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix mutex unlock placement and free memory on config load.
authorAdam Sutton <dev@adamsutton.me.uk>
Fri, 25 May 2012 13:40:51 +0000 (14:40 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Mon, 30 Jul 2012 14:46:53 +0000 (15:46 +0100)
src/epggrab.c

index 8245bf5f18558eb83269fa6755ce2021200c971a..cebe43c207624f1b95bb03fc3da51651fd6b13fe 100644 (file)
@@ -77,14 +77,16 @@ static void _epggrab_module_run ( epggrab_module_t *mod, const char *opts )
 
   /* Process */
   if ( data ) {
-    //htsmsg_print(data);
     tvhlog(LOG_DEBUG, mod->name(), "grab took %d seconds", tm2 - tm1);
     pthread_mutex_lock(&global_lock);
     time(&tm1);
-    save = mod->parse(data, &stats);
+    save |= mod->parse(data, &stats);
     time(&tm2);
+    if (save) epg_updated();  
     pthread_mutex_unlock(&global_lock);
     htsmsg_destroy(data);
+
+    /* Debug stats */
     tvhlog(LOG_DEBUG, mod->name(), "parse took %d seconds", tm2 - tm1);
     tvhlog(LOG_DEBUG, mod->name(), "  channels   tot=%5d new=%5d mod=%5d",
            stats.channels.total, stats.channels.created,
@@ -102,10 +104,6 @@ static void _epggrab_module_run ( epggrab_module_t *mod, const char *opts )
            stats.broadcasts.total, stats.broadcasts.created,
            stats.broadcasts.modified);
 
-    /* Updated */
-    // TODO: should epg_updated happen inside or outside the lock?
-    if (save) epg_updated();  
-
   } else {
     tvhlog(LOG_WARNING, mod->name(), "grab returned no data");
   }
@@ -235,6 +233,7 @@ void _epggrab_load ( void )
       }
     }
   }
+  htsmsg_destroy(m);
 }
 
 void _epggrab_save ( void )