[vlc-commits] access: dvb: scan: check scan_service_New return

Francois Cartegnie git at videolan.org
Sun Apr 10 13:56:10 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Apr  6 16:42:10 2016 +0200| [629956c230c3c89c4e6fbd7f8f4f5b7567aec947] | committer: Francois Cartegnie

access: dvb: scan: check scan_service_New return

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=629956c230c3c89c4e6fbd7f8f4f5b7567aec947
---

 modules/access/dvb/scan.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index 7ca6fdf..aeb35b2 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -854,11 +854,14 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit )
                     if( (ScanFindService( p_scan, 0, i_service_id ) == NULL) &&
                          scan_service_type( i_service_type ) != SERVICE_UNKNOWN )
                     {
-                       scan_service_t *s = scan_service_New( i_service_id, p_cfg );
-                       s->type          = scan_service_type( i_service_type );
-                       s->i_network_id  = p_nit->i_network_id;
-                       s->i_nit_version = p_nit->i_version;
-                       TAB_APPEND( p_scan->i_service, p_scan->pp_service, s );
+                        scan_service_t *s = scan_service_New( i_service_id, p_cfg );
+                        if( likely(s) )
+                        {
+                            s->type          = scan_service_type( i_service_type );
+                            s->i_network_id  = p_nit->i_network_id;
+                            s->i_nit_version = p_nit->i_version;
+                            TAB_APPEND( p_scan->i_service, p_scan->pp_service, s );
+                        }
                     }
                 }
             }
@@ -970,7 +973,8 @@ void scan_session_Destroy( scan_t *p_scan, scan_session_t *p_session )
             if( s == NULL )
             {
                 s = scan_service_New( p_program->i_number, &p_session->cfg );
-                TAB_APPEND( p_scan->i_service, p_scan->pp_service, s );
+                if( likely(s) )
+                    TAB_APPEND( p_scan->i_service, p_scan->pp_service, s );
             }
         }
     }



More information about the vlc-commits mailing list