[vlc-devel] commit: vout_omapfb: fix potential leaks. ( Rémi Duraffort )
git version control
git at videolan.org
Thu Mar 19 23:20:29 CET 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Mar 18 14:52:57 2009 +0100| [68ab6616fab70807333a193a998520f2878a5404] | committer: Rémi Duraffort
vout_omapfb: fix potential leaks.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=68ab6616fab70807333a193a998520f2878a5404
---
modules/video_output/omapfb.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/video_output/omapfb.c b/modules/video_output/omapfb.c
index 8a33371..95c2eaf 100644
--- a/modules/video_output/omapfb.c
+++ b/modules/video_output/omapfb.c
@@ -1,7 +1,7 @@
/*****************************************************************************
* omapfb.c : omap framebuffer plugin for vlc
*****************************************************************************
-* Copyright (C) 2008 the VideoLAN team
+* Copyright (C) 2008-2009 the VideoLAN team
* $Id$
*
* Authors: Antoine Lejeune <phytos @ videolan.org>
@@ -191,10 +191,9 @@ static int Create( vlc_object_t *p_this )
return VLC_EGENERIC;
/* Allocate instance and initialize some members */
- p_vout->p_sys = p_sys = malloc( sizeof( vout_sys_t ) );
+ p_vout->p_sys = p_sys = calloc( 1, sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
return VLC_ENOMEM;
- memset( p_sys, 0, sizeof(vout_sys_t) );
p_vout->pf_init = Init;
p_vout->pf_end = End;
@@ -556,7 +555,6 @@ static int OpenDisplay( vout_thread_t *p_vout )
return VLC_EGENERIC;
}
free( psz_device );
- psz_device = NULL;
// Get caps, try older interface if needed
if( ioctl( p_sys->i_fd, OMAPFB_GET_CAPS, &p_sys->caps ) != 0 )
@@ -575,11 +573,13 @@ static int OpenDisplay( vout_thread_t *p_vout )
if( ioctl( p_sys->i_fd, FBIOGET_VSCREENINFO, &p_sys->fb_vinfo ) )
{
msg_Err( p_vout, "Can't get VSCREENINFO: %s", strerror(errno) );
+ close( p_sys->i_fd );
return VLC_EGENERIC;
}
if( ioctl( p_sys->i_fd, FBIOGET_FSCREENINFO, &p_sys->fb_finfo ) )
{
msg_Err( p_vout, "Can't get FSCREENINFO: %s", strerror(errno) );
+ close( p_sys->i_fd );
return VLC_EGENERIC;
}
@@ -591,6 +591,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
p_sys->i_fd, 0 )) == MAP_FAILED )
{
msg_Err( p_vout, "Can't mmap: %s", strerror(errno) );
+ close( p_sys->i_fd );
return VLC_EGENERIC;
}
@@ -601,6 +602,8 @@ static int OpenDisplay( vout_thread_t *p_vout )
if( p_sys->i_null_fd == -1 )
{
msg_Err( p_vout, "cannot open /dev/zero (%m)" );
+ munmap( p_sys->p_video, p_sys->i_page_size );
+ close( p_sys->i_fd );
return VLC_EGENERIC;
}
@@ -608,6 +611,9 @@ static int OpenDisplay( vout_thread_t *p_vout )
MAP_PRIVATE, p_sys->i_null_fd, 0 )) == MAP_FAILED )
{
msg_Err( p_vout, "Can't mmap 2: %s", strerror(errno) );
+ munmap( p_sys->p_video, p_sys->i_page_size );
+ close( p_sys->i_null_fd );
+ close( p_sys->i_fd );
return VLC_EGENERIC;
}
More information about the vlc-devel
mailing list