Fix a possible crash in QSoundEffect.
authorRobin Burchell <robin.burchell@jollamobile.com>
Wed, 7 Nov 2012 22:23:45 +0000 (23:23 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 9 Nov 2012 10:46:04 +0000 (11:46 +0100)
pa_stream_cork may fail, and pa_operation_unref won't handle that gracefully, so
check the return value before unreffing.

Done-with: Vesa-Matti Hartikainen
Change-Id: If789e37a13f85487c79dd8a03a7ca3624b1412d2
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
src/multimedia/audio/qsoundeffect_pulse_p.cpp

index a1010fa..3546c86 100644 (file)
@@ -838,7 +838,9 @@ void QSoundEffectPrivate::playSample()
 #endif
     Q_ASSERT(m_pulseStream);
     Q_ASSERT(pa_stream_get_state(m_pulseStream) == PA_STREAM_READY);
-    pa_operation_unref(pa_stream_cork(m_pulseStream, 0, 0, 0));
+    pa_operation *o = pa_stream_cork(m_pulseStream, 0, 0, 0);
+    if (o)
+        pa_operation_unref(o);
 }
 
 void QSoundEffectPrivate::stop()