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>
macos/master
Li Qiang 8 years ago committed by Dave Airlie
parent 8e88187881
commit 0a5dff1591
  1. 5
      src/vrend_decode.c

@ -1093,6 +1093,11 @@ void vrend_renderer_context_destroy(uint32_t handle)
if (handle >= VREND_MAX_CTX) if (handle >= VREND_MAX_CTX)
return; return;
/* never destroy context 0 here, it will be destroyed in vrend_decode_reset()*/
if (handle == 0) {
return;
}
ctx = dec_ctx[handle]; ctx = dec_ctx[handle];
if (!ctx) if (!ctx)
return; return;

Loading…
Cancel
Save