[vlc-devel] [PATCH 2/3] demux/ts: handle allocation error

remi at remlab.net remi at remlab.net
Wed Dec 2 20:46:23 CET 2020


From: RĂ©mi Denis-Courmont <remi at remlab.net>

---
 modules/demux/mpeg/ts.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 54edd253ab..9c7c4625c6 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -454,8 +454,14 @@ static int Open( vlc_object_t *p_this )
 
         p_sys->csa = csa_New();
 
-        psz_csa2 = var_CreateGetStringCommand( p_demux, "ts-csa2-ck" );
-        i_res = csa_SetCW( (vlc_object_t*)p_demux, p_sys->csa, psz_string, true );
+        if( p_sys->csa )
+        {
+            psz_csa2 = var_CreateGetStringCommand( p_demux, "ts-csa2-ck" );
+            i_res = csa_SetCW( (vlc_object_t*)p_demux, p_sys->csa, psz_string, true );
+        }
+        else
+            i_res = VLC_ENOMEM;
+
         if( i_res == VLC_SUCCESS && psz_csa2 && *psz_csa2 )
         {
             if( csa_SetCW( (vlc_object_t*)p_demux, p_sys->csa, psz_csa2, false ) != VLC_SUCCESS )
-- 
2.29.2



More information about the vlc-devel mailing list