summaryrefslogtreecommitdiff
path: root/src/driver.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-03-26 15:19:33 +0100
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-03-26 15:19:44 +0100
commite5b5297ac449fb4ac62cc6471f933ae2265778a2 (patch)
treecfbf633873007fbe227a50c7f91c24366c4f1438 /src/driver.c
parent1e571934629280053caeb155e418acbdca609e36 (diff)
modesetting: clean up leaks
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Diffstat (limited to 'src/driver.c')
-rw-r--r--src/driver.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/driver.c b/src/driver.c
index 87ba272..06d6d53 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -206,7 +206,7 @@ static Bool probe_hw(char *dev)
int fd = open_hw(dev);
if (fd != -1) {
close(fd);
- return TRUE;
+ return TRUE;
}
return FALSE;
}
@@ -530,15 +530,27 @@ static void msBlockHandler(BLOCKHANDLER_ARGS_DECL)
static void
FreeRec(ScrnInfoPtr pScrn)
{
+ modesettingPtr ms;
+
if (!pScrn)
- return;
+ return;
- if (!pScrn->driverPrivate)
- return;
+ ms = modesettingPTR(pScrn);
+ if (!ms)
+ return;
+ pScrn->driverPrivate = NULL;
- free(pScrn->driverPrivate);
+ if (ms->fd > 0) {
+ int ret;
+
+ if (ms->pEnt->location.type == BUS_PCI)
+ ret = drmClose(ms->fd);
+ else
+ ret = close(ms->fd);
+ }
+ free(ms->Options);
+ free(ms);
- pScrn->driverPrivate = NULL;
}
static Bool
@@ -596,8 +608,8 @@ PreInit(ScrnInfoPtr pScrn, int flags)
#if XSERVER_PLATFORM_BUS
if (pEnt->location.type == BUS_PLATFORM) {
- char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH);
- ms->fd = open_hw(path);
+ char *path = xf86_get_platform_device_attrib(pEnt->location.id.plat, ODEV_ATTRIB_PATH);
+ ms->fd = open_hw(path);
}
else
#endif