[vlc-commits] PulseAudio: handle unlikely NULL deref in Close() (fix LP#754497)

Rémi Denis-Courmont git at videolan.org
Mon Apr 25 11:57:43 CEST 2011


vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Apr 25 12:56:43 2011 +0300| [035a1578173dc0627a4aa9530123f6485308da5f] | committer: Rémi Denis-Courmont

PulseAudio: handle unlikely NULL deref in Close() (fix LP#754497)

(not applicable to master branch)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=035a1578173dc0627a4aa9530123f6485308da5f
---

 modules/audio_output/pulse.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index e413c86..198fdbc 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -357,14 +357,18 @@ static void Close ( vlc_object_t *p_this )
         pa_operation *o;
 
         o = pa_stream_flush(p_sys->stream, success_cb, p_aout);
-        while( pa_operation_get_state(o) == PA_OPERATION_RUNNING )
-            pa_threaded_mainloop_wait(p_sys->mainloop);
-        pa_operation_unref(o);
+        if (likely(o != NULL)) {
+            while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+                pa_threaded_mainloop_wait(p_sys->mainloop);
+            pa_operation_unref(o);
+        }
 
         o = pa_stream_drain(p_sys->stream, success_cb, p_aout);
-        while( pa_operation_get_state(o) == PA_OPERATION_RUNNING )
-            pa_threaded_mainloop_wait(p_sys->mainloop);
-        pa_operation_unref(o);
+        if (likely(o != NULL)) {
+            while (pa_operation_get_state(o) == PA_OPERATION_RUNNING)
+                pa_threaded_mainloop_wait(p_sys->mainloop);
+            pa_operation_unref(o);
+        }
 
         pa_threaded_mainloop_unlock(p_sys->mainloop);
     }



More information about the vlc-commits mailing list