[virglrenderer-devel] [PATCH] renderer: fix memory leak in vertext elements state create
Li Qiang
liq3ea at gmail.com
Sat Feb 25 11:05:55 UTC 2017
Sorry, I didn't switch the git branch, I will resend another.
Thanks.
2017-02-25 19:03 GMT+08:00 Li Qiang <liq3ea at gmail.com>:
> From: Li Qiang <liq3ea at gmail.com>
>
> Free the vertex array in error path.
> This was introduced by this commit:
> renderer: fix heap overflow in vertex elements state create.
>
> Signed-off-by: Li Qiang <liq3ea at gmail.com>
> ---
> src/vrend_renderer.c | 4 +++-
> tests/test_virgl_cmd.c | 10 +++++-----
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index 1bca7ad..7c2053f 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -1657,8 +1657,10 @@ int vrend_create_vertex_elements_state(struct
> vrend_context *ctx,
> if (!v)
> return ENOMEM;
>
> - if (num_elements > PIPE_MAX_ATTRIBS)
> + if (num_elements > PIPE_MAX_ATTRIBS) {
> + FREE(v)
> return EINVAL;
> + }
>
> v->count = num_elements;
> for (i = 0; i < num_elements; i++) {
> diff --git a/tests/test_virgl_cmd.c b/tests/test_virgl_cmd.c
> index b342e85..a993471 100644
> --- a/tests/test_virgl_cmd.c
> +++ b/tests/test_virgl_cmd.c
> @@ -1014,13 +1014,13 @@ static Suite *virgl_init_suite(void)
>
> s = suite_create("virgl_clear");
> tc_core = tcase_create("clear");
> - tcase_add_test(tc_core, virgl_test_clear);
> +// tcase_add_test(tc_core, virgl_test_clear);
> tcase_add_test(tc_core, virgl_test_blit_simple);
> tcase_add_test(tc_core, virgl_test_overlap_obj_id);
> - tcase_add_test(tc_core, virgl_test_large_shader);
> - tcase_add_test(tc_core, virgl_test_render_simple);
> - tcase_add_test(tc_core, virgl_test_render_geom_simple);
> - tcase_add_test(tc_core, virgl_test_render_xfb);
> +// tcase_add_test(tc_core, virgl_test_large_shader);
> +// tcase_add_test(tc_core, virgl_test_render_simple);
> +// tcase_add_test(tc_core, virgl_test_render_geom_simple);
> +// tcase_add_test(tc_core, virgl_test_render_xfb);
>
> suite_add_tcase(s, tc_core);
> return s;
> --
> 2.7.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/virglrenderer-devel/attachments/20170225/bde8c68e/attachment.html>
More information about the virglrenderer-devel
mailing list