[vlc-commits] Call aout_PacketDestroy() on error paths too

Rémi Denis-Courmont git at videolan.org
Thu Aug 4 18:38:21 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug  4 18:46:44 2011 +0300| [9b8e8006fe984942079f9fb51533b8e97f6e22b9] | committer: Rémi Denis-Courmont

Call aout_PacketDestroy() on error paths too

aout_PacketInit() does not allocate anything yet, but it will have too.

By the way, the error paths of the (untouched by the commit)
DirectSound plugin seem a bit suspicious to me...

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

 modules/audio_output/alsa.c      |    1 +
 modules/audio_output/auhal.c     |    2 ++
 modules/audio_output/jack.c      |    1 +
 modules/audio_output/oss.c       |    1 +
 modules/audio_output/portaudio.c |    2 ++
 modules/audio_output/waveout.c   |    1 +
 6 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index b0f9166..6ed8d9d 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -501,6 +501,7 @@ static int Open (vlc_object_t *obj)
                    VLC_THREAD_PRIORITY_OUTPUT ) )
     {
         msg_Err( p_aout, "cannot create ALSA thread (%m)" );
+        aout_PacketDestroy (p_aout);
         vlc_sem_destroy( &p_sys->wait );
         goto error;
     }
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 325770c..4b94f77 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -796,6 +796,7 @@ static int OpenSPDIF( audio_output_t * p_aout )
     if( err != noErr )
     {
         msg_Err( p_aout, "AudioDeviceCreateIOProcID failed: [%4.4s]", (char *)&err );
+        aout_PacketDestroy (p_aout);
         return false;
     }
 
@@ -816,6 +817,7 @@ static int OpenSPDIF( audio_output_t * p_aout )
         {
             msg_Err( p_aout, "AudioDeviceDestroyIOProcID failed: [%4.4s]", (char *)&err );
         }
+        aout_PacketDestroy (p_aout);
         return false;
     }
 
diff --git a/modules/audio_output/jack.c b/modules/audio_output/jack.c
index 8a34ceb..68dd0e4 100644
--- a/modules/audio_output/jack.c
+++ b/modules/audio_output/jack.c
@@ -236,6 +236,7 @@ error_out:
         {
             jack_deactivate( p_sys->p_jack_client );
             jack_client_close( p_sys->p_jack_client );
+            aout_PacketDestroy( p_aout );
         }
         free( p_sys->p_jack_ports );
         free( p_sys->p_jack_buffers );
diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 704a70d..c1c5ec6 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -508,6 +508,7 @@ static int Open( vlc_object_t *p_this )
     {
         msg_Err( p_aout, "cannot create OSS thread (%m)" );
         close( p_sys->i_fd );
+        aout_PacketDestroy( p_aout );
         free( p_sys );
         return VLC_ENOMEM;
     }
diff --git a/modules/audio_output/portaudio.c b/modules/audio_output/portaudio.c
index 797dbef..8b564d4 100644
--- a/modules/audio_output/portaudio.c
+++ b/modules/audio_output/portaudio.c
@@ -544,6 +544,7 @@ static int PAOpenStream( audio_output_t *p_aout )
                      paLastHostErrorInfo->errorText );
         }
         p_sys->p_stream = 0;
+        aout_PacketDestroy( p_aout );
         return VLC_EGENERIC;
     }
 
@@ -552,6 +553,7 @@ static int PAOpenStream( audio_output_t *p_aout )
     {
         msg_Err( p_aout, "Pa_StartStream() failed" );
         Pa_CloseStream( p_sys->p_stream );
+        aout_PacketDestroy( p_aout );
         return VLC_EGENERIC;
     }
 
diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index 79f8e0a..3729a40 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -311,6 +311,7 @@ static int Open( vlc_object_t *p_this )
         malloc( p_aout->sys->i_buffer_size );
     if( p_aout->sys->p_silence_buffer == NULL )
     {
+        aout_PacketDestroy( p_aout );
         free( p_aout->sys );
         return VLC_ENOMEM;
     }



More information about the vlc-commits mailing list