Fix crash when writing epg cache to the disk
authorbetacentauri <betacentauri@arcor.de>
Sat, 9 May 2015 18:40:32 +0000 (20:40 +0200)
committerpieterg <pieterg@users.sourceforge.net>
Mon, 11 May 2015 12:20:20 +0000 (14:20 +0200)
Timestamp in contentTimeMap can differ from eventData timestamp.
In such cases eventData is not removed from timeMap. timeMap is
used in eEPGCache::save which accesses in such a case freed memory.
This can cause crash.

Signed-off-by: pieterg <pieterg@users.sourceforge.net>

lib/dvb/epgcache.cpp

index 05dfd68..d42053c 100644 (file)
@@ -3560,10 +3560,12 @@ void eEPGCache::privateSectionRead(const uniqueEPGKey &current_service, const ui
                eventMap::iterator evIt( evMap.find(it->second.second) );
                if ( evIt != evMap.end() )
                {
+                       // time_event_map can have other timestamp -> get timestamp from eventData
+                       time_t ev_time = evIt->second->getStartTime();
                        delete evIt->second;
                        evMap.erase(evIt);
+                       tmMap.erase(ev_time);
                }
-               tmMap.erase(it->second.first);
        }
        time_event_map.clear();