summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/acecad.c24
-rw-r--r--src/acecad.h1
2 files changed, 18 insertions, 7 deletions
diff --git a/src/acecad.c b/src/acecad.c
index a3326a0..6a0b347 100644
--- a/src/acecad.c
+++ b/src/acecad.c
@@ -126,7 +126,7 @@ _X_EXPORT InputDriverRec ACECAD =
"acecad",
NULL,
AceCadPreInit,
- NULL,
+ AceCadUnInit,
NULL,
default_options
};
@@ -462,16 +462,26 @@ AceCadPreInit(InputDriverPtr drv, InputInfoPtr local, int flags)
* If something went wrong, cleanup and return NULL
*/
SetupProc_fail:
- if ((local) && (local->fd))
+ return BadAlloc;
+}
+
+static void
+AceCadUnInit(InputDriverPtr drv, InputInfoPtr local, int flags)
+{
+ AceCadPrivatePtr priv = (AceCadPrivatePtr) (local->private);
+
+ if (local->fd > -1)
+ {
xf86CloseSerial (local->fd);
- if ((priv) && (priv->buffer))
- XisbFree (priv->buffer);
+ local->fd = -1;
+ }
+
if (priv) {
+ if (priv->buffer)
+ XisbFree (priv->buffer);
free (priv);
- if (local)
- local->private = NULL;
+ local->private = NULL;
}
- return BadAlloc;
}
static Bool
diff --git a/src/acecad.h b/src/acecad.h
index b9291c7..48fa38a 100644
--- a/src/acecad.h
+++ b/src/acecad.h
@@ -106,6 +106,7 @@ static Bool QueryHardware (AceCadPrivatePtr);
static void NewPacket (AceCadPrivatePtr priv);
static Bool AceCadGetPacket (AceCadPrivatePtr);
static int AceCadPreInit(InputDriverPtr, InputInfoPtr , int);
+static void AceCadUnInit(InputDriverPtr, InputInfoPtr , int);
#ifdef HAVE_LINUX_INPUT_H
static void USBReadInput (InputInfoPtr);
static Bool USBQueryHardware (InputInfoPtr);