[virglrenderer-devel] [PATCH] renderer: fix a leak in resource attach

Li Qiang liq3ea at gmail.com
Tue Dec 27 02:23:55 UTC 2016


Just return if the resource has been attached a iov
to avoid memory leak.

Signed-off-by: Li Qiang <liq3ea at gmail.com>
---
 src/vrend_renderer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index da7cbed..00b61eb 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4031,6 +4031,9 @@ int vrend_renderer_resource_attach_iov(int res_handle, struct iovec *iov,
    if (!res)
       return EINVAL;
 
+   if (res->iov)
+      return 0;
+
    /* work out size and max resource size */
    res->iov = iov;
    res->num_iovs = num_iovs;
-- 
2.7.4



More information about the virglrenderer-devel mailing list