From 40b0e7813325b08077b6f541b3989edb2d86d837 Mon Sep 17 00:00:00 2001 From: Li Qiang Date: Mon, 26 Dec 2016 21:23:42 -0500 Subject: [PATCH] renderer: fix a leak in resource attach Just return if the resource has been attached a iov to avoid memory leak. Signed-off-by: Li Qiang Signed-off-by: Dave Airlie --- 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;