[vlc-devel] [PATCH 1/2] DirectSound: use calloc for aout_stream_sys_t

Felix Abecassis felix.abecassis at gmail.com
Fri Feb 28 15:54:54 CET 2014


Fix a crash occurring when CreateDSBufferPCM() fails in Start() and
afterwards Stop() uses uninitialized pointer values when releasing
objects.
---
 modules/audio_output/directsound.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index c7ab2e3..b2a9ca6 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -747,7 +747,7 @@ static HRESULT StreamStart( aout_stream_t *s,
                             audio_sample_format_t *restrict fmt,
                             const GUID *sid )
 {
-    aout_stream_sys_t *sys = malloc( sizeof( *sys ) );
+    aout_stream_sys_t *sys = calloc( 1, sizeof( *sys ) );
     if( unlikely(sys == NULL) )
         return E_OUTOFMEMORY;
 
-- 
1.7.10.4




More information about the vlc-devel mailing list