virglrenderer: fix some memory leaks on cleanup

Writing some unit tests with valgrind, showed we don't always
cleanup properly fix that.
macos/master
Dave Airlie 10 years ago
parent f38615b5e3
commit 8ea7848b6e
  1. 1
      src/virglrenderer.c
  2. 2
      src/vrend_decode.c
  3. 3
      src/vrend_renderer.c

@ -255,6 +255,7 @@ void virgl_renderer_poll(void)
void virgl_renderer_cleanup(void *cookie)
{
vrend_renderer_fini();
if (use_egl_context) {
virgl_egl_destroy(egl_info);
egl_info = NULL;

@ -1008,7 +1008,7 @@ void vrend_renderer_context_destroy(uint32_t handle)
ret = vrend_destroy_context(ctx->grctx);
free(ctx);
/* switch to ctx 0 */
if (ret)
if (ret && handle != 0)
vrend_hw_switch_context(dec_ctx[0]->grctx, TRUE);
}

@ -3177,7 +3177,9 @@ vrend_renderer_fini(void)
if (!inited)
return;
vrend_renderer_context_destroy(0);
vrend_object_fini_resource_table();
inited = 0;
}
@ -3245,6 +3247,7 @@ bool vrend_destroy_context(struct vrend_context *ctx)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
vrend_bind_va(0);
vrend_object_fini_ctx_table(ctx->res_hash);
FREE(ctx);
return switch_0;

Loading…
Cancel
Save