[virglrenderer-devel] [PATCH] vrend: fix a leak in context create internal

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


Create a context more than once causes memory leak issue.
Juest return if the context exists.

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

diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index 409cec7..ede7280 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -1045,6 +1045,10 @@ void vrend_renderer_context_create_internal(uint32_t handle, uint32_t nlen,
    if (handle >= VREND_MAX_CTX)
       return;
 
+   dctx = dec_ctx[handle];
+   if (dctx)
+      return;
+
    dctx = malloc(sizeof(struct vrend_decode_ctx));
    if (!dctx)
       return;
-- 
2.7.4



More information about the virglrenderer-devel mailing list