[virglrenderer-devel] [PATCH v2] renderer: fix memory leak in vertext elements state create
Li Qiang
liq3ea at gmail.com
Sat Feb 25 11:10:10 UTC 2017
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 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 1bca7ad..115fddc 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)
- return EINVAL;
+ if (num_elements > PIPE_MAX_ATTRIBS) {
+ FREE(v);
+ return EINVAL;
+ }
v->count = num_elements;
for (i = 0; i < num_elements; i++) {
--
2.7.4
More information about the virglrenderer-devel
mailing list