riched20: Make sure to use GlobalAlloc with GlobalFree.

Robert Shearman rob at codeweavers.com
Tue Oct 24 06:08:28 CDT 2006


Mike McCormack wrote:
>      ret->ref = 1;
>      ret->cur = 0;
>      ret->fmtetc_cnt = fmtetc_cnt;
> -    ret->fmtetc = HeapAlloc(GetProcessHeap(), 0, fmtetc_cnt*sizeof(FORMATETC));
> +    ret->fmtetc = GlobalAlloc(GMEM_ZEROINIT, fmtetc_cnt*sizeof(FORMATETC));
>      memcpy(ret->fmtetc, fmtetc, fmtetc_cnt*sizeof(FORMATETC));
>      *lplpformatetc = (LPENUMFORMATETC)ret;
>      return S_OK;

Why use GMEM_ZEROINIT when you initialise all of the memory straight 
after the GlobalAlloc call?

-- 
Rob Shearman




More information about the wine-devel mailing list