[pulseaudio-discuss] [PATCH] srbchannel: Check return value of pa_memblock_new_pool
Alexander E. Patrakov
patrakov at gmail.com
Thu Dec 4 13:38:45 PST 2014
05.12.2014 02:06, David Henningsson wrote:
> In case PA_MEMPOOL_DISABLE is set, pa_memblock_new_pool can return
> NULL. It does not make sense to set up a srbchannel without a shared
> memory pool, so just fail in this case.
The patch indeed avoids the assertion failure. Thanks!
>
> Reported-by: Alexander Patrakov <patrakov at gmail.com>
> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
> ---
> src/pulsecore/srbchannel.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/pulsecore/srbchannel.c b/src/pulsecore/srbchannel.c
> index a0f916e..8872a89 100644
> --- a/src/pulsecore/srbchannel.c
> +++ b/src/pulsecore/srbchannel.c
> @@ -231,6 +231,9 @@ pa_srbchannel* pa_srbchannel_new(pa_mainloop_api *m, pa_mempool *p) {
> pa_srbchannel* sr = pa_xmalloc0(sizeof(pa_srbchannel));
> sr->mainloop = m;
> sr->memblock = pa_memblock_new_pool(p, -1);
> + if (!sr->memblock)
> + goto fail;
> +
> srh = pa_memblock_acquire(sr->memblock);
> pa_zero(*srh);
>
>
--
Alexander E. Patrakov
More information about the pulseaudio-discuss
mailing list