[vlc-commits] [Git][videolan/vlc][master] 2 commits: access: jack: use vlc_alloc helper

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Mar 8 21:23:10 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
4261a24b by Tristan Matthews at 2023-03-08T21:07:58+00:00
access: jack: use vlc_alloc helper

- - - - -
0c25f466 by Tristan Matthews at 2023-03-08T21:07:58+00:00
audio_output: jack: use vlc_alloc helper

- - - - -


2 changed files:

- modules/access/jack.c
- modules/audio_output/jack.c


Changes:

=====================================
modules/access/jack.c
=====================================
@@ -185,8 +185,7 @@ static int Open( vlc_object_t *p_this )
 
     /* allocate input ports */
     if( p_sys->i_channels == 0 ) p_sys->i_channels = 2 ; /* default number of port */
-    p_sys->pp_jack_port_input = malloc(
-        p_sys->i_channels * sizeof( jack_port_t* ) );
+    p_sys->pp_jack_port_input = vlc_alloc( p_sys->i_channels, sizeof( jack_port_t* ) );
     if( p_sys->pp_jack_port_input == NULL )
     {
         jack_client_close( p_sys->p_jack_client );
@@ -225,8 +224,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     /* allocate buffer for input ports */
-    p_sys->pp_jack_buffer = malloc ( p_sys->i_channels
-        * sizeof( jack_default_audio_sample_t * ) );
+    p_sys->pp_jack_buffer = vlc_alloc( p_sys->i_channels, sizeof( jack_default_audio_sample_t * ) );
     if( p_sys->pp_jack_buffer == NULL )
     {
         for( unsigned i = 0; i < p_sys->i_channels; i++ )


=====================================
modules/audio_output/jack.c
=====================================
@@ -162,16 +162,14 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
     p_sys->i_channels = aout_FormatNbChannels( fmt );
     aout_FormatPrepare(fmt);
 
-    p_sys->p_jack_ports = malloc( p_sys->i_channels *
-                                  sizeof(jack_port_t *) );
+    p_sys->p_jack_ports = vlc_alloc( p_sys->i_channels, sizeof(jack_port_t *) );
     if( p_sys->p_jack_ports == NULL )
     {
         status = VLC_ENOMEM;
         goto error_out;
     }
 
-    p_sys->p_jack_buffers = malloc( p_sys->i_channels *
-                                    sizeof(jack_sample_t *) );
+    p_sys->p_jack_buffers = vlc_alloc( p_sys->i_channels, sizeof(jack_sample_t *) );
     if( p_sys->p_jack_buffers == NULL )
     {
         status = VLC_ENOMEM;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/394232d640aa3d140c50347ee0de8290878f6a6c...0c25f4669fd63d1ae745754b0a9f7cb69135b9cb

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/394232d640aa3d140c50347ee0de8290878f6a6c...0c25f4669fd63d1ae745754b0a9f7cb69135b9cb
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list