On 2014-08-18 19:17, Peter Meerwald wrote:

handle_srbchannel_memblock() should return when memblock sanity checks fail

Hmm, the reason I kept it on separate lines was for more specific error
checking, i e, you could tell which of the checks that failed from looking in
the debug log. IIRC, I'm not sure? But yeah, the early return makes sense.

ah, ok; I'll add three returns then

any objections to apply the series?

No objections, go ahead.


thanks, p.

Signed-off-by: Peter Meerwald <[email protected]>
Cc: David Henningsson <[email protected]>
---
   src/pulse/context.c |    9 ++++-----
   1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/pulse/context.c b/src/pulse/context.c
index db89b58..b8ebced 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -350,12 +350,11 @@ static void handle_srbchannel_memblock(pa_context *c,
pa_memblock *memblock) {
       pa_assert(c);

       /* Memblock sanity check */
-    if (!memblock)
-        pa_context_fail(c, PA_ERR_PROTOCOL);
-    else if (pa_memblock_is_read_only(memblock))
-        pa_context_fail(c, PA_ERR_PROTOCOL);
-    else if (pa_memblock_is_ours(memblock))
+    if (!memblock || pa_memblock_is_read_only(memblock) ||
+        pa_memblock_is_ours(memblock)) {
           pa_context_fail(c, PA_ERR_PROTOCOL);
+        return;
+    }

       /* Create the srbchannel */
       c->srb_template.memblock = memblock;





--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to