[Piglit] [PATCH v1 2/2] test: fix resources usage for depthstencil-render-miplevels

Sergii Romantsov sergii.romantsov at gmail.com
Mon Nov 26 12:04:53 UTC 2018


Hello, Eric
>
> Can you explain how not freeing memory could cause a core dump on exit?

Core mostly was generated due: a number of levels is max_miplevel (level 0
is also available, so index should be counted as <=max_miplevel), but array
that holds pointers is size of max_miplevel (so without counting of
0-level). In that way happens array index out of bounds + memory allocation
to some undefined address.


> And, in general, I would recommend just freeing data after usage,
> rather than having a deinit function.

Looks like it may complicate a logic and code of test. Test may exit with
any call to 'piglit_report_result' and it can happens on any stage of
execution. In proposed mechanism we shouldn't care when and why exit is
done, so we can be sure that all resources will be freed.

On Fri, Nov 23, 2018 at 7:35 PM Eric Anholt <eric at anholt.net> wrote:

> Sergii Romantsov <sergii.romantsov at gmail.com> writes:
>
> > Usage test 'depthstencil-render-miplevels 200 s=z24_s8' causes core dump
> on exit.
> > Issues:
> > 1. Allocation of memory many times to the same variable
> > 2. Not complete array to store pointers
> > 3. Absence of memory freeing
>
> Can you explain how not freeing memory could cause a core dump on exit?
> And, in general, I would recommend just freeing data after usage, rather
> than having a deinit function.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20181126/78d63df1/attachment.html>


More information about the Piglit mailing list