[vlc-devel] commit: Fix automatic libv4l2 fallback and prevent leaks when doing so. ( Antoine Cellerier )

git version control git at videolan.org
Sat Oct 3 18:18:45 CEST 2009


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Sat Oct  3 18:18:01 2009 +0200| [db67bdc4cd6f4067f4049f2be0be36d4f37a9344] | committer: Antoine Cellerier 

Fix automatic libv4l2 fallback and prevent leaks when doing so.

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

 modules/access/v4l2.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c
index 0ead7bf..3aaf3e4 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -2432,12 +2432,14 @@ static bool ProbeVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys,
     {
         struct v4l2_input t_input;
         memset( &t_input, 0, sizeof(t_input) );
+        p_sys->i_input = 0;
         while( v4l2_ioctl( i_fd, VIDIOC_ENUMINPUT, &t_input ) >= 0 )
         {
             p_sys->i_input++;
             t_input.index = p_sys->i_input;
         }
 
+        free( p_sys->p_inputs );
         p_sys->p_inputs = calloc( 1, p_sys->i_input * sizeof( struct v4l2_input ) );
         if( !p_sys->p_inputs ) goto open_failed;
 
@@ -2473,6 +2475,7 @@ static bool ProbeVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys,
             t_standards.index = p_sys->i_standard;
         }
 
+        free( p_sys->p_standards );
         p_sys->p_standards = calloc( 1, p_sys->i_standard * sizeof( struct v4l2_standard ) );
         if( !p_sys->p_standards ) goto open_failed;
 
@@ -2538,6 +2541,7 @@ static bool ProbeVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys,
             tuner.index = p_sys->i_tuner;
         }
 
+        free( p_sys->p_tuners );
         p_sys->p_tuners = calloc( 1, p_sys->i_tuner * sizeof( struct v4l2_tuner ) );
         if( !p_sys->p_tuners ) goto open_failed;
 
@@ -2601,6 +2605,7 @@ static bool ProbeVideoDev( vlc_object_t *p_obj, demux_sys_t *p_sys,
 
         p_sys->i_codec = i_index;
 
+        free( p_sys->p_codecs );
         p_sys->p_codecs = calloc( 1, p_sys->i_codec * sizeof( struct v4l2_fmtdesc ) );
 
         for( i_index = 0; i_index < p_sys->i_codec; i_index++ )




More information about the vlc-devel mailing list