This could explain inconsistent behaviour, intialized was accessed
uninitialized (oh, the irony!).

For good effort, calloc _and_ initialize "initialized". Two zeros are more
than one, after all.

Signed-off-by: Peter Hutterer <[email protected]>
---
Changes to v2:
- fix indentation issues, it's tabs all the way down now
- remove superfluous isdv4data assignment

both fixes for -ENOCOFFEE...

 src/wcmISDV4.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index 4c75da6..f2959b1 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -187,16 +187,19 @@ static Bool isdv4ParseOptions(LocalDevicePtr local)
                        return FALSE;
        }
 
-       if (!common->private &&
-           !(common->private = malloc(sizeof(wcmISDV4Data))))
+       if (!common->private)
        {
-               xf86Msg(X_ERROR, "%s: failed to alloc backend-specific data.\n",
+               if (!(common->private = calloc(1, sizeof(wcmISDV4Data))))
+               {
+                       xf86Msg(X_ERROR, "%s: failed to alloc backend-specific 
data.\n",
                                local->name);
+                       return FALSE;
+               }
+               isdv4data = common->private;
+               isdv4data->baudrate = baud;
+               isdv4data->initialized = 0;
        }
 
-       isdv4data = common->private;
-       isdv4data->baudrate = baud;
-
        return TRUE;
 }
 
-- 
1.7.1

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to