[PATCH] xlib: Initilize event type

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 22 15:44:03 PST 2010


On Wed, 22 Dec 2010 19:21:13 +0200, Pauli <ext-pauli.nieminen at nokia.com> wrote:
> From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> 
> If we receive unsupported event closing connection triggers valgrind
> error.
> 
> ==12017== Conditional jump or move depends on uninitialised value(s)
> ==12017==    at 0x487D454: _XFreeDisplayStructure (OpenDis.c:607)
> ==12017==    by 0x486857B: XCloseDisplay (ClDisplay.c:72)
> *snip*
> ==12017==  Uninitialised value was created by a heap allocation
> ==12017==    at 0x4834C48: malloc (vg_replace_malloc.c:236)
> ==12017==    by 0x4894147: _XEnq (XlibInt.c:877)
> ==12017==    by 0x4891BF3: handle_response (xcb_io.c:335)
> ==12017==    by 0x4892263: _XReply (xcb_io.c:626)
> *snip*
> 
> Problem is that XFreeDisplaySturture is checking for qelt->event.type ==
> GenericEvent while _XUnknownWireEvent doesn't store the type.
> 
> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>


> ---
>  src/XlibInt.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/XlibInt.c b/src/XlibInt.c
> index 11a85ba..d55c26a 100644
> --- a/src/XlibInt.c
> +++ b/src/XlibInt.c
> @@ -883,6 +883,8 @@ void _XEnq(
>  
>  	type = event->u.u.type & 0177;
>  	extension = ((xGenericEvent*)event)->extension;
> +
> +	qelt->event.type = type;
>  	/* If an extension has registerd a generic_event_vec handler, then
>  	 * it can handle event cookies. Otherwise, proceed with the normal
>  	 * event handlers.
> -- 
> 1.7.0.4
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list