On 2014-06-17 16:10, Peter Meerwald wrote:
From: Peter Meerwald <[email protected]>

memblock.c: Assertion 'pa_atomic_load(&b->n_acquired) == 0'
failed at pulsecore/memblock.c:532, function memblock_free(). Aborting.

the reason is that re->memblock is acquired, but not released

the fail exit path releases the memblock if necessary

Aha, thanks for finding it. Indeed there is an unmatched pa_memblock_acquire.

the return value of 1 looks suspicious too (should be -1 or 0 I think)

Well, if pa_srbchannel_read returns 0, it means that there is currently nothing to read. So it isn't a "fail". So I couldn't return 0 (means continue reading), couldn't return -1 (means failure), so I chose 1.

But documenting this choice wouldn't hurt, I guess...


Signed-off-by: Peter Meerwald <[email protected]>
---
  src/pulsecore/pstream.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 505a5e0..57aad43 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -711,7 +711,7 @@ static int do_read(pa_pstream *p, struct pstream_read *re) {
      if (re == &p->readsr) {
          r = pa_srbchannel_read(p->sr, d, l);
          if (r == 0)
-            return 1;
+            goto fail;
      }
      else
  #ifdef HAVE_CREDS


--
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