On Mon, Aug 27, 2018 at 09:16:55PM +0300, Alexey Budankov wrote:

SNIP

>       if ((md->start & md->mask) + size != (md->end & md->mask)) {
>               buf = &data[md->start & md->mask];
> -             size = md->mask + 1 - (md->start & md->mask);
> -             md->start += size;
> -
> -             if (push(to, buf, size) < 0) {
> -                     rc = -1;
> -                     goto out;
> -             }
> +             size0 = md->mask + 1 - (md->start & md->mask);
> +             md->start += size0;
> +             memcpy(md->data, buf, size0);
>       }
>  
>       buf = &data[md->start & md->mask];
>       size = md->end - md->start;
>       md->start += size;
> +     memcpy(md->data + size0, buf, size);
>  
> -     if (push(to, buf, size) < 0) {
> -             rc = -1;
> +     rc = push(to, md, size0 + size, *off) < 0 ? -1 : 1;
> +     if (rc == -1)
>               goto out;
> -     }
> +
> +     perf_mmap__get(md);
> +     *off += size0 + size;

this get is for the perf_mmap pointer storage in the mmap_aio array right?

I see it's released in record__mmap_read_sync, which might also return
without releasing it.. this needs to be fixed and explained in here,
why we take the reference in the first place

thanks,
jirka

Reply via email to