fixed possible nullpointer dereference in listboxservice.
authorSteven Hoving <stevenhoving@gmail.com>
Sat, 24 Oct 2015 11:37:34 +0000 (13:37 +0200)
committerSteven Hoving <stevenhoving@gmail.com>
Sat, 24 Oct 2015 11:37:34 +0000 (13:37 +0200)
fixed initing eBouquet pointer with NULL instead of 0.

cppcheck reported these as:
Summary: Possible null pointer dereference: bouquet
Message: Possible null pointer dereference: bouquet

lib/dvb/epgcache.cpp
lib/service/listboxservice.cpp
lib/service/servicedvb.cpp

index 577a1ec..a001752 100644 (file)
@@ -89,7 +89,7 @@ const eServiceReference &handleGroup(const eServiceReference &ref)
                        ePtr<iDVBChannelList> db;
                        if (!res->getChannelList(db))
                        {
-                               eBouquet *bouquet=0;
+                               eBouquet *bouquet = NULL;
                                if (!db->getBouquet(ref, bouquet))
                                {
                                        std::list<eServiceReference>::iterator it(bouquet->m_services.begin());
index f9afd2d..3003396 100644 (file)
@@ -560,11 +560,13 @@ bool eListboxServiceContent::checkServiceIsRecorded(eServiceReference ref)
                        ePtr<eDVBResourceManager> res;
                        eDVBResourceManager::getInstance(res);
                        res->getChannelList(db);
-                       eBouquet *bouquet=0;
-                       db->getBouquet(ref, bouquet);
-                       for (std::list<eServiceReference>::iterator i(bouquet->m_services.begin()); i != bouquet->m_services.end(); ++i)
-                               if (*i == it->second)
-                                       return true;
+                       eBouquet *bouquet = NULL;
+                       if (!db->getBouquet(ref, bouquet))
+                       {
+                               for (std::list<eServiceReference>::iterator i(bouquet->m_services.begin()); i != bouquet->m_services.end(); ++i)
+                                       if (*i == it->second)
+                                               return true;
+                       }
                }
                else if (ref == it->second)
                        return true;
index d613c9f..95bd056 100644 (file)
@@ -183,7 +183,7 @@ RESULT eStaticServiceDVBBouquetInformation::getName(const eServiceReference &ref
                return err;
        }
 
-       eBouquet *bouquet=0;
+       eBouquet *bouquet = NULL;
        if ((err = db->getBouquet(ref, bouquet)) != 0)
        {
                eDebug("[eStaticServiceDVBBouquetInformation] getName failed.. getBouquet failed!");
@@ -219,7 +219,7 @@ int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref
                        return 0;
                }
 
-               eBouquet *bouquet=0;
+               eBouquet *bouquet = NULL;
                if (db->getBouquet(ref, bouquet))
                {
                        eDebug("[eStaticServiceDVBBouquetInformation] isPlayable failed.. getBouquet failed!");