From: Adam Sutton Date: Fri, 25 May 2012 13:40:51 +0000 (+0100) Subject: Fix mutex unlock placement and free memory on config load. X-Git-Tag: 3.3~405 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bd6b8a4793609f829b3ccf9ef57d9833ff47634b;p=thirdparty%2Ftvheadend.git Fix mutex unlock placement and free memory on config load. --- diff --git a/src/epggrab.c b/src/epggrab.c index 8245bf5f1..cebe43c20 100644 --- a/src/epggrab.c +++ b/src/epggrab.c @@ -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 )