[vlc-devel] commit: vout_fb: fix a potential memleak and some cleanings. ( Rémi Duraffort )

git version control git at videolan.org
Tue Mar 17 22:05:53 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Mar 17 21:52:40 2009 +0100| [48aef0f087ea191b5032a79cb496bba69c512e92] | committer: Rémi Duraffort 

vout_fb: fix a potential memleak and some cleanings.

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

 modules/video_output/fb.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index 8880b36..1796b70 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * fb.c : framebuffer plugin for vlc
  *****************************************************************************
- * Copyright (C) 2000, 2001 the VideoLAN team
+ * Copyright (C) 2000-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Samuel Hocevar <sam at zoy.org>
@@ -186,10 +186,9 @@ static int Create( vlc_object_t *p_this )
     struct termios      new_termios;
 
     /* 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_sys->p_video = MAP_FAILED;
 
@@ -212,6 +211,7 @@ static int Create( vlc_object_t *p_this )
     if( p_sys->b_tty && !isatty( 0 ) )
     {
         msg_Warn( p_vout, "fd 0 is not a TTY" );
+        free( p_sys );
         return VLC_EGENERIC;
     }
     else
@@ -239,7 +239,6 @@ static int Create( vlc_object_t *p_this )
                       psz_chroma );
         }
         free( psz_chroma );
-        psz_chroma = NULL;
     }
 
     p_sys->i_aspect = -1;
@@ -258,7 +257,6 @@ static int Create( vlc_object_t *p_this )
                   atoi( psz_aspect ), atoi( psz_parser ) );
 
         free( psz_aspect );
-        psz_aspect = NULL;
     }
 
     p_sys->b_auto = false;
@@ -284,7 +282,6 @@ static int Create( vlc_object_t *p_this )
         case 4:
         default:
             p_sys->b_auto = true;
-            break;
      }
 
     /* tty handling */
@@ -783,7 +780,6 @@ static int OpenDisplay( vout_thread_t *p_vout )
         return VLC_EGENERIC;
     }
     free( psz_device );
-    psz_device = NULL;
 
     /* Get framebuffer device information */
     if( ioctl( p_sys->i_fd, FBIOGET_VSCREENINFO, &p_sys->var_info ) )




More information about the vlc-devel mailing list