[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:22:08 CEST 2009


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

Fix automatic libv4l2 fallback and prevent leaks when doing so.
(cherry picked from commit db67bdc4cd6f4067f4049f2be0be36d4f37a9344)

Signed-off-by: Antoine Cellerier <dionoea at videolan.org>

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

 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 c20dde7..77dcdaa 100644
--- a/modules/access/v4l2.c
+++ b/modules/access/v4l2.c
@@ -2421,12 +2421,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;
 
@@ -2462,6 +2464,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;
 
@@ -2527,6 +2530,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;
 
@@ -2590,6 +2594,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