summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-03-21 15:29:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-21 15:56:45 +1000
commit6bd8bfe6ae72d028436fb4435f8d01e211b49a36 (patch)
tree62449fea2aafe4dfa4604bc4d83dd916c32dfbce
parent67e1fef9d3f35edaeab71247d9c888074130f61e (diff)
downloadxf86-input-wacom-6bd8bfe6ae72d028436fb4435f8d01e211b49a36.tar.gz
Fix broken NULL check
This check was ok until 7958bb9b1ddef9e8238615fd1b3d15996f00effe, when more code was moved here and it made no sense this way anymore. Change it to return early in the case of NULL allocation. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/wcmCommon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 0f041e3..35c302e 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1455,9 +1455,10 @@ WacomCommonPtr wcmNewCommon(void)
{
WacomCommonPtr common;
common = calloc(1, sizeof(WacomCommonRec));
- if (common)
- common->refcnt = 1;
+ if (!common)
+ return NULL;;
+ common->refcnt = 1;
common->wcmFlags = 0; /* various flags */
common->wcmProtocolLevel = WCM_PROTOCOL_4; /* protocol level */
common->wcmTPCButton = 0; /* set Tablet PC button on/off */