[PATCH v2 2/3] [libx11] Using uninitialized value "p->modifiers"

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 31 13:01:01 PST 2011


On 01/31/11 02:03 AM, Erkki Seppälä wrote:
> Small fix by using Xcalloc instead of Xmalloc
> 
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> 
> diff --git a/src/KeyBind.c b/src/KeyBind.c
> index 6d80a02..ac25ce2 100644
> --- a/src/KeyBind.c
> +++ b/src/KeyBind.c
> @@ -996,7 +996,7 @@ XRebindKeysym (
>      tmp = dpy->key_bindings;
>      nb = sizeof(KeySym) * nm;
>  
> -    if ((! (p = (struct _XKeytrans *) Xmalloc( sizeof(struct _XKeytrans)))) ||
> +    if ((! (p = (struct _XKeytrans *) Xcalloc( 1, sizeof(struct _XKeytrans)))) ||
>  	((! (p->string = (char *) Xmalloc( (unsigned) nbytes))) &&
>  	 (nbytes > 0)) ||
>  	((! (p->modifiers = (KeySym *) Xmalloc( (unsigned) nb))) &&

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list