From 3d97fa1c3a5404ae02ed67eb94a5519394ba2bf5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 2 Nov 2010 09:23:41 +1000 Subject: Move allocation of mPriv down. No functional change. If we get to this point, we know it's available. Signed-off-by: Peter Hutterer Acked-by: Thomas Hellstrom --- src/vmmouse.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/vmmouse.c') 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; -- cgit v1.2.3