[PATCH] windowscodecs: Fix memory leak.

Nikolay Sivov bunglehead at gmail.com
Mon Jan 22 03:47:50 CST 2018


On 1/22/2018 11:26 AM, Andrey Gusev wrote:
> Signed-off-by: Andrey Gusev <andrey.goosev at gmail.com>
> ---
>  dlls/windowscodecs/stream.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/dlls/windowscodecs/stream.c b/dlls/windowscodecs/stream.c
> index 308ef8e02b..1fb3967b32 100644
> --- a/dlls/windowscodecs/stream.c
> +++ b/dlls/windowscodecs/stream.c
> @@ -1009,8 +1009,10 @@ static HRESULT map_file(HANDLE file, HANDLE *map, void **mem, LARGE_INTEGER *siz
>      if (!(*mem = MapViewOfFile(*map, FILE_MAP_READ, 0, 0, size->u.LowPart)))
>      {
>          CloseHandle(*map);
> +        UnmapViewOfFile(mem);
>          return HRESULT_FROM_WIN32(GetLastError());
>      }
> +    UnmapViewOfFile(mem);
>      return S_OK;
>  }
>  
> 

This makes no sense, even if you fix function argument. First unmap call
will be called on NULL pointer, second call will unmap what's meant to
be returned to the caller.

What was the idea behind this?



More information about the wine-devel mailing list