[vlc-devel] commit: V4L2: error handling ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jul 5 20:35:58 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jul 5 21:37:49 2008 +0300| [e00e13dbbef8d29716b133298f95ffb72079e886]
V4L2: error handling
confere posix_memalign documentation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e00e13dbbef8d29716b133298f95ffb72079e886
---
modules/access/v4l2/v4l2.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/modules/access/v4l2/v4l2.c b/modules/access/v4l2/v4l2.c
index 6b7c7e6..2b03f91 100644
--- a/modules/access/v4l2/v4l2.c
+++ b/modules/access/v4l2/v4l2.c
@@ -1761,32 +1761,25 @@ static int InitUserP( demux_t *p_demux, int i_fd, unsigned int i_buffer_size )
if( ioctl( i_fd, VIDIOC_REQBUFS, &req ) < 0 )
{
msg_Err( p_demux, "device does not support user pointer i/o" );
- goto open_failed;
+ return VLC_EGENERIC;
}
p_sys->p_buffers = calloc( 4, sizeof( *p_sys->p_buffers ) );
if( !p_sys->p_buffers )
- {
- msg_Err( p_demux, "Out of memory" );
goto open_failed;
- }
for( p_sys->i_nbuffers = 0; p_sys->i_nbuffers < 4; ++p_sys->i_nbuffers )
{
p_sys->p_buffers[p_sys->i_nbuffers].length = i_buffer_size;
- posix_memalign( &p_sys->p_buffers[p_sys->i_nbuffers].start,
- /* boundary */ i_page_size, i_buffer_size );
-
- if( !p_sys->p_buffers[p_sys->i_nbuffers].start )
- {
- msg_Err( p_demux, "out of memory" );
+ if( posix_memalign( &p_sys->p_buffers[p_sys->i_nbuffers].start,
+ /* boundary */ i_page_size, i_buffer_size ) )
goto open_failed;
- }
}
return VLC_SUCCESS;
open_failed:
+ free( p_sys->p_buffers );
return VLC_EGENERIC;
}
More information about the vlc-devel
mailing list