[PATCH] hidclass.sys: avoid leaking event in error path (Coverity)

Aric Stewart aric at codeweavers.com
Tue Aug 23 12:59:48 CDT 2016


Nikolay's patch also solves this. I am picking that one as i think it is better not to create the event.

-aric

On 8/22/16 4:19 PM, Marcus Meissner wrote:
> 1371732 Resource leak
> 
> Signed-off-by: Marcus Meissner <marcus at jet.franken.de>
> ---
>  dlls/hidclass.sys/pnp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
> index 8fd5c17..8ad0d6e 100644
> --- a/dlls/hidclass.sys/pnp.c
> +++ b/dlls/hidclass.sys/pnp.c
> @@ -62,8 +62,10 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
>      HANDLE event = CreateEventA(NULL, FALSE, FALSE, NULL);
>  
>      irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, device, NULL, 0, NULL, NULL, &irp_status);
> -    if (irp == NULL)
> +    if (irp == NULL) {
> +        CloseHandle(event);
>          return STATUS_NO_MEMORY;
> +    }
>  
>      irp->UserEvent = event;
>      irpsp = IoGetNextIrpStackLocation(irp);
> 



More information about the wine-patches mailing list