On Sun, Jul 4, 2010 at 8:59 PM, Peter Hutterer <[email protected]> wrote:
> 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]>
> ---
> the first version had a nasty bug, resetting initialized for every device
> and thus being rather pointless. silly me.
>
>  src/wcmISDV4.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
> index 4c75da6..be10dff 100644
> --- a/src/wcmISDV4.c
> +++ b/src/wcmISDV4.c
> @@ -187,15 +187,20 @@ static Bool isdv4ParseOptions(LocalDevicePtr local)
>                        return FALSE;
>        }
>
> -       if (!common->private &&
> -           !(common->private = malloc(sizeof(wcmISDV4Data))))
> +       if (!common->private)
>        {
> +           if (!(common->private = calloc(1, sizeof(wcmISDV4Data))))
> +           {
>                xf86Msg(X_ERROR, "%s: failed to alloc backend-specific 
> data.\n",

Need a leading tab.

>                                local->name);
> +               return FALSE;

Need a leading tab.

> +           }
> +           isdv4data = common->private;
> +           isdv4data->baudrate = baud;
> +           isdv4data->initialized = 0;
>        }
>
>        isdv4data = common->private;

Why do we need to keep this?

Ping

> -       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
>

------------------------------------------------------------------------------
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