[pulseaudio-discuss] [PATCH v2 11/12] stream: Check pa_tagstruct_get_format_info() retval in pa_create_stream_callback()

Peter Meerwald pmeerw at pmeerw.net
Tue Sep 15 15:01:49 PDT 2015


CID 1137984
---
 src/pulse/stream.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 6fea996..e10ab12 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -1137,18 +1137,16 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag,
         || s->context->version >= 22) {
 
         pa_format_info *f = pa_format_info_new();
-        pa_tagstruct_get_format_info(t, f);
 
-        if (pa_format_info_valid(f))
-            s->format = f;
-        else {
+        if (pa_tagstruct_get_format_info(t, f) < 0 || !pa_format_info_valid(f)) {
             pa_format_info_free(f);
             if (s->n_formats > 0) {
                 /* We used the extended API, so we should have got back a proper format */
                 pa_context_fail(s->context, PA_ERR_PROTOCOL);
                 goto finish;
             }
-        }
+        } else
+            s->format = f;
     }
 
     if (!pa_tagstruct_eof(t)) {
-- 
1.9.1



More information about the pulseaudio-discuss mailing list