summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Qiang <liq3ea@gmail.com>2017-01-05 18:02:46 -0800
committerDave Airlie <airlied@redhat.com>2017-02-10 14:07:52 +1000
commit0a5dff15912207b83018485f83e067474e818bab (patch)
treead4a07bc22bff400d993db1a6698c58af8195092
parent8e88187881907e5e4382e74305f74cfca2a434d5 (diff)
vrend: never destroy context 0 in vrend_renderer_context_destroy
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 by calling vrend_decode_reset. Signed-off-by: Li Qiang <liq3ea@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/vrend_decode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index cab3956..11ac1ed 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -1093,6 +1093,11 @@ void vrend_renderer_context_destroy(uint32_t handle)
if (handle >= VREND_MAX_CTX)
return;
+ /* never destroy context 0 here, it will be destroyed in vrend_decode_reset()*/
+ if (handle == 0) {
+ return;
+ }
+
ctx = dec_ctx[handle];
if (!ctx)
return;