]> code.delx.au - pulseaudio/commitdiff
client: verify connection state in pa_stream_connect_upload()
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Jan 2010 02:01:27 +0000 (03:01 +0100)
committerColin Guthrie <cguthrie@mandriva.org>
Tue, 9 Feb 2010 22:31:01 +0000 (22:31 +0000)
Make suer we check the connection state before going on, so that we can
rely that s->context->pstream is properly initialized.

https://bugzilla.redhat.com/show_bug.cgi?id=539500

src/pulse/scache.c

index 2a7602fd2f1eca10b4dab1ba3776a15221f8acbf..b2169b6eb4fed993cdf348c19d0d1923bc3bfe84 100644 (file)
@@ -49,6 +49,7 @@ int pa_stream_connect_upload(pa_stream *s, size_t length) {
     PA_CHECK_VALIDITY(s->context, s->state == PA_STREAM_UNCONNECTED, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY(s->context, length > 0, PA_ERR_INVALID);
     PA_CHECK_VALIDITY(s->context, length == (size_t) (uint32_t) length, PA_ERR_INVALID);
+    PA_CHECK_VALIDITY(s->context, s->context->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);
 
     if (!(name = pa_proplist_gets(s->proplist, PA_PROP_EVENT_ID)))
         name = pa_proplist_gets(s->proplist, PA_PROP_MEDIA_NAME);