# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../xf86-input-fpit/0002-Fix-module-unloading.patch
# Copyright (C) 2010 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---

From d8e6b7594dcf9bb622693be471939a0918e1f320 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri, 28 Aug 2009 08:16:36 +1000
Subject: [PATCH 2/3] Fix module unloading.

After calling xfree(priv), local->private must be set NULL.
Otherwise the server tries to free it again during xf86DeleteInput.

local->name must not be freed, it is set to XI_TOUCHSCREEN during PreInit.

local must not be freed, we pass it into xf86DeleteInput.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 src/xf86Fpit.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/xf86Fpit.c b/src/xf86Fpit.c
index f40c6a9..ce7540b 100644
--- a/src/xf86Fpit.c
+++ b/src/xf86Fpit.c
@@ -589,8 +589,7 @@ static void xf86FpitUninit(InputDriverPtr drv, LocalDevicePtr local, int flags)
 	xf86FpitControl(local->dev, DEVICE_OFF);
 	xfree(priv->fpitDev);
 	xfree(priv);
-	xfree(local->name);
-	xfree(local);
+	local->private = NULL;
 	xf86DeleteInput(local, 0);
 }
 
-- 
1.6.5.3