[virglrenderer-devel] [PATCH] vrend: never destroy context 0 in vrend_renderer_context_destroy

Li Qiang liq3ea at gmail.com
Thu Dec 29 08:41:41 UTC 2016


There will be a crash if the guest destroy context 0. As the context 0 is 
allocate in renderer init, not destroy in vrend_renderer_context_destroy. 
The context will be freed in renderer fini. 

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 09f08ae..1bbcfda 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -1089,6 +1089,10 @@ void vrend_renderer_context_destroy(uint32_t handle)
    if (handle >= VREND_MAX_CTX)
       return;
 
+   /* never destroy context 0 */
+   if (handle == 0)
+      return;
+
    ctx = dec_ctx[handle];
    if (!ctx)
       return;
-- 
2.7.4



More information about the virglrenderer-devel mailing list