[2/2] kernel32: Don't leak extrabuf when HeapReAlloc fails

Henri Verbeet hverbeet at gmail.com
Thu Jan 30 04:31:34 CST 2014


On 29 January 2014 23:41, André Hentschel <nerv at dawncrow.de> wrote:
> -        extrabuf = HeapReAlloc( GetProcessHeap(), 0, extrabuf, ebufsize ) ;
> +        if (newbuf = HeapReAlloc( GetProcessHeap(), 0, extrabuf, ebufsize ))
> +            extrabuf = newbuf;
> +        else
> +            break;
This will introduce a warning:
    computername.c: In function ‘dns_gethostbyname’:
    computername.c:90:9: warning: suggest parentheses around
assignment used as truth value [-Wparentheses]

I happen to think
+        if (!(newbuf = HeapReAlloc( GetProcessHeap(), 0, extrabuf, ebufsize )))
+            break;
+        extrabuf = newbuf;
would be slightly nicer anyway.



More information about the wine-devel mailing list