Skip to contentSkip to conversation

nouveau: fix winsys object leak

PATCH In review Marcin Slusarz 1 participant 2 messages Jan 17, 2010 – Jan 24, 2010 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: fix winsys object leak

---
 src/gallium/drivers/nouveau/nouveau_screen.c       |    2 ++
 .../winsys/drm/nouveau/drm/nouveau_drm_api.c       |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
src/gallium/drivers/nouveau/nouveau_screen.c +2 -0
index 7ebc94e..1ad539d 100644
@@ -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);
 }
 
src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +9 -0
index 4b2c6a1..39b985c 100644
@@ -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) {
Signature · 1 line
1.6.6

A message that is not in the archive (sent off-list or not yet received): [email protected]