[PATCH] memblock: Initialize mempool object to zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



10.12.2014 03:00, David Henningsson wrote:
> This fixes a "use of uninitialised value" error in previous memblock commit.

I have just tested it - indeed, no more valgrind warnings :)

>
> Reported-by: Alexander Patrakov <patrakov at gmail.com>
> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
> ---
>   src/pulsecore/memblock.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
> index eb85d1f..b781312 100644
> --- a/src/pulsecore/memblock.c
> +++ b/src/pulsecore/memblock.c
> @@ -751,7 +751,7 @@ pa_mempool* pa_mempool_new(bool shared, size_t size) {
>       pa_mempool *p;
>       char t1[PA_BYTES_SNPRINT_MAX], t2[PA_BYTES_SNPRINT_MAX];
>
> -    p = pa_xnew(pa_mempool, 1);
> +    p = pa_xnew0(pa_mempool, 1);
>
>       p->block_size = PA_PAGE_ALIGN(PA_MEMPOOL_SLOT_SIZE);
>       if (p->block_size < PA_PAGE_SIZE)
> @@ -778,7 +778,6 @@ pa_mempool* pa_mempool_new(bool shared, size_t size) {
>                    pa_bytes_snprint(t2, sizeof(t2), (unsigned) (p->n_blocks * p->block_size)),
>                    (unsigned long) pa_mempool_block_size_max(p));
>
> -    memset(&p->stat, 0, sizeof(p->stat));
>       pa_atomic_store(&p->n_init, 0);
>
>       PA_LLIST_HEAD_INIT(pa_memimport, p->imports);
>

-- 
Alexander E. Patrakov


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux