summaryrefslogtreecommitdiff
path: root/src/vmmouse.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-11-02 09:23:41 +1000
committerThomas Hellstrom <thellstrom@vmware.com>2010-11-04 08:57:40 +0100
commit3d97fa1c3a5404ae02ed67eb94a5519394ba2bf5 (patch)
treebf4009d7e7ea6e46b74eddec4ba57dc7e96d65d0 /src/vmmouse.c
parent4e08974ead62fc50ebbe0190abce78c5de3fcdff (diff)
Move allocation of mPriv down.
No functional change. If we get to this point, we know it's available. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'src/vmmouse.c')
-rw-r--r--src/vmmouse.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/vmmouse.c b/src/vmmouse.c
index 32abd9e..9d366e2 100644
--- a/src/vmmouse.c
+++ b/src/vmmouse.c
@@ -268,15 +268,6 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
#endif
- mPriv = calloc (1, sizeof (VMMousePrivRec));
-
-
- if (!mPriv) {
- return NULL;
- }
-
- mPriv->absoluteRequested = FALSE;
-
/*
* try to enable vmmouse here
*/
@@ -286,13 +277,11 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
* Fall back to normal mouse module
*/
xf86Msg(X_ERROR, "VMWARE(0): vmmouse enable failed\n");
- free(mPriv);
return VMMouseInitPassthru(drv, dev, flags);
} else {
/*
* vmmouse is available
*/
- mPriv->vmmouseAvailable = TRUE;
xf86Msg(X_INFO, "VMWARE(0): vmmouse is available\n");
/*
* Disable the absolute pointing device for now
@@ -302,10 +291,19 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
}
if (!(pInfo = xf86AllocateInput(drv, 0))) {
- free(mPriv);
return NULL;
}
+ mPriv = calloc (1, sizeof (VMMousePrivRec));
+
+ if (!mPriv) {
+ xf86DeleteInput(pInfo, 0);
+ return NULL;
+ }
+
+ mPriv->absoluteRequested = FALSE;
+ mPriv->vmmouseAvailable = TRUE;
+
/* Settup the pInfo */
pInfo->name = dev->identifier;
pInfo->type_name = XI_MOUSE;