diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2016-06-08 21:18:52 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2017-04-06 23:36:07 +0300 |
commit | a604d9cbb3199c2a4c7e12e37def228a43553890 (patch) | |
tree | 6877e599668e222931cb9876f533d35f93de893b | |
parent | 2432270a73294676d43918beb99b7303040b274a (diff) |
memblock: multiple references should make blocks read-only
The old code makes no sense to me. Why would multiple references mean
that a previously read-only memblock is suddenly writable? I'm pretty
sure that the original intention was to treat multi-referenced blocks
as read-only. I don't have any examples where the old code would have
caused bad behaviour, however.
-rw-r--r-- | src/pulsecore/memblock.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c index dbad32a2..fb83dac5 100644 --- a/src/pulsecore/memblock.c +++ b/src/pulsecore/memblock.c @@ -497,7 +497,7 @@ bool pa_memblock_is_read_only(pa_memblock *b) { pa_assert(b); pa_assert(PA_REFCNT_VALUE(b) > 0); - return b->read_only && PA_REFCNT_VALUE(b) == 1; + return b->read_only || PA_REFCNT_VALUE(b) > 1; } /* No lock necessary */ |