winex11.drv: Fix uninitialised values. (valgrind) (try 2)

Michael Stefaniuc mstefani at redhat.com
Tue Aug 10 03:05:31 CDT 2010


Hello Austin,

Austin Lund wrote:
> 
> ------------------------------------------------------------------------
> From 07bc18edc35c68c8e0da58a70ccd5c8f03584a1a Mon Sep 17 00:00:00 2001
> From: Austin Lund <austin.lund at gmail.com>
> Date: Tue, 10 Aug 2010 13:03:14 +1000
> Subject: [PATCH] winex11.drv: Fix uninitialised values. (valgrind)
> 
> ---
>  dlls/winex11.drv/bitmap.c |    2 +-
>  dlls/winex11.drv/dib.c    |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c
> index 4683fd9..af6c00b 100644
> --- a/dlls/winex11.drv/bitmap.c
> +++ b/dlls/winex11.drv/bitmap.c
> @@ -351,7 +351,7 @@ LONG CDECL X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count )
>      wine_tsx11_lock();
>      image = XCreateImage( gdi_display, visual, physBitmap->pixmap_depth, ZPixmap, 0, NULL,
>                            bitmap.bmWidth, height, 32, 0 );
> -    if (!(image->data = HeapAlloc( GetProcessHeap(), 0, image->bytes_per_line * height )))
> +    if (!(image->data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, image->bytes_per_line * height )))
>      {
>          WARN("No memory to create image data.\n");
>          XDestroyImage( image );
> diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
> index 11157f1..eda064e 100644
> --- a/dlls/winex11.drv/dib.c
> +++ b/dlls/winex11.drv/dib.c
> @@ -3535,7 +3535,7 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
>      else {
>          bmpImage = XCreateImage( gdi_display, visual, descr->depth, ZPixmap, 0, NULL,
>  				 descr->infoWidth, lines, 32, 0 );
> -	bmpImage->data = HeapAlloc( GetProcessHeap(), 0, lines * bmpImage->bytes_per_line );
> +	bmpImage->data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lines * bmpImage->bytes_per_line );
>          if(bmpImage->data == NULL) {
>              ERR("Out of memory!\n");
>              XDestroyImage( bmpImage );
> 
both functions are heavily used and you don't want to waste time
HEAP_ZERO_MEMORY just to please valgrind. I even wonder why valgrind
complains as e.g. in X11DRV_SetBitmapBits() only the default switch case
won't initialize the memory at all.

bye
	michael



More information about the wine-devel mailing list