]> git.sesse.net Git - vlc/commitdiff
TS demux: fix memory leak using ACCESS_SET_PRIVATE_ID_CA
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 28 Nov 2009 10:13:38 +0000 (12:13 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 28 Nov 2009 10:15:04 +0000 (12:15 +0200)
If the access does not support CAM, we need to free the PMT
(closes #3163)

modules/access/bda/bda.c
modules/demux/ts.c

index a063c42994df2e7ba2d8da593d80575e9d6a37ef..5db2322c32a1d83381d62b1444a9156af34ea39e 100644 (file)
@@ -577,7 +577,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         b_bool = (bool)va_arg( args, int );
         break;
     case ACCESS_SET_PRIVATE_ID_CA:  /* 12 -From Demux */
-        break;
+        return VLC_EGENERIC;
     default:
         msg_Warn( p_access,
                   "DVB_Control: Unimplemented query in control %d", i_query );
index b71355fe50ff4fdc705a34f4ca507258d3deac87..1a5125958374fd9fa64800c38377f9586267b4d2 100644 (file)
@@ -4133,16 +4133,11 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
         }
     }
 
-    if( ProgramIsSelected( p_demux, prg->i_number ) )
-    {
-        /* Set CAM descrambling */
-        stream_Control( p_demux->s, STREAM_CONTROL_ACCESS,
-                        ACCESS_SET_PRIVATE_ID_CA, p_pmt );
-    }
-    else
-    {
+    /* Set CAM descrambling */
+    if( !ProgramIsSelected( p_demux, prg->i_number )
+     || stream_Control( p_demux->s, STREAM_CONTROL_ACCESS,
+                        ACCESS_SET_PRIVATE_ID_CA, p_pmt ) != VLC_SUCCESS )
         dvbpsi_DeletePMT( p_pmt );
-    }
 
     for( int i = 0; i < i_clean; i++ )
     {