[PATCH 5/6] dinput: Fix usage of HeapReAlloc.

Alexandre Julliard julliard at winehq.org
Sat Dec 27 13:26:41 CST 2008


Vitaliy Margolen <wine-patches at kievinfo.com> writes:

> +        if (!have_joydevs)
> +            joydevs = HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev));
> +        else
> +            joydevs = HeapReAlloc(GetProcessHeap(), 0, joydevs, (1 + have_joydevs) * sizeof(struct JoyDev));
> +
> +        if (!joydevs)
> +        {
> +            close(fd);
> +            continue;
> +        }

While you are fixing it you should fix it properly by preserving the old
pointer on failure.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list