nouveau: fix winsys object leak

This commit is contained in:
Marcin Slusarz 2010-01-17 23:50:50 +01:00 committed by Ben Skeggs
parent 833acea8f6
commit 283b21d02b
2 changed files with 11 additions and 0 deletions

View file

@ -260,6 +260,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
void
nouveau_screen_fini(struct nouveau_screen *screen)
{
struct pipe_winsys *ws = screen->base.winsys;
nouveau_channel_free(&screen->channel);
ws->destroy(ws);
}

View file

@ -54,6 +54,14 @@ static struct dri1_api nouveau_dri1_api = {
nouveau_dri1_front_surface,
};
static void
nouveau_drm_destroy_winsys(struct pipe_winsys *s)
{
struct nouveau_winsys *nv_winsys = nouveau_winsys(s);
FREE(nv_winsys->pctx);
FREE(nv_winsys);
}
static struct pipe_screen *
nouveau_drm_create_screen(struct drm_api *api, int fd,
struct drm_create_screen_arg *arg)
@ -105,6 +113,7 @@ nouveau_drm_create_screen(struct drm_api *api, int fd,
return NULL;
}
ws = &nvws->base;
ws->destroy = nouveau_drm_destroy_winsys;
nvws->pscreen = init(ws, dev);
if (!nvws->pscreen) {