[vlc-devel] commit: screen_win32: fix potential memleak and use DeleteDC instead of ReleaseDC. ( Rémi Duraffort )

git version control git at videolan.org
Sun Mar 8 23:08:27 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Mar  8 21:46:14 2009 +0100| [406a01541ce145dff8f05aaac963686c4b622924] | committer: Rémi Duraffort 

screen_win32: fix potential memleak and use DeleteDC instead of ReleaseDC.

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

 modules/access/screen/win32.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/access/screen/win32.c b/modules/access/screen/win32.c
index 3812393..fd0adbc 100644
--- a/modules/access/screen/win32.c
+++ b/modules/access/screen/win32.c
@@ -64,6 +64,7 @@ int screen_InitCapture( demux_t *p_demux )
     if( !p_data->hdc_src )
     {
         msg_Err( p_demux, "cannot get device context" );
+        free( p_data );
         return VLC_EGENERIC;
     }
 
@@ -71,6 +72,7 @@ int screen_InitCapture( demux_t *p_demux )
     if( !p_data->hdc_dst )
     {
         msg_Err( p_demux, "cannot get compat device context" );
+        free( p_data );
         ReleaseDC( 0, p_data->hdc_src );
         return VLC_EGENERIC;
     }
@@ -90,8 +92,9 @@ int screen_InitCapture( demux_t *p_demux )
     default:
         msg_Err( p_demux, "unknown screen depth %i",
                  p_sys->fmt.video.i_bits_per_pixel );
+        DeleteDC( p_data->hdc_dst );
         ReleaseDC( 0, p_data->hdc_src );
-        ReleaseDC( 0, p_data->hdc_dst );
+        free( p_data );
         return VLC_EGENERIC;
     }
 




More information about the vlc-devel mailing list