[PATCH] gdi32: Fix memory leak on error in PATH_WidenPath (Coverity)

Huw Davies huw at codeweavers.com
Fri Jun 1 05:24:18 CDT 2018


On Thu, May 31, 2018 at 11:03:36PM -0600, Alex Henrie wrote:
> Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
> ---
> CID 716634 (#1 of 1): Resource leak (RESOURCE_LEAK)
> 
> leaked_storage: Variable pStrokes going out of scope leaks the storage
> it points to.
> 
>  dlls/gdi32/path.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
> index 41cab60515..ceb8d29977 100644
> --- a/dlls/gdi32/path.c
> +++ b/dlls/gdi32/path.c
> @@ -1749,6 +1749,8 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
>                  break;
>              default:
>                  ERR("Got path flag %c\n", flat_path->flags[i]);
> +                HeapFree(GetProcessHeap(), 0, pStrokes);
> +                free_gdi_path(flat_path);
>                  return NULL;
>          }
>      }

Not that this really matters, but since you're doing it, we should
also free the paths stored in the pStrokes array.

Huw.



More information about the wine-devel mailing list