[PATCH] hidclass.sys: add missing case/missing heapfree (Coverity)

Aric Stewart aric at codeweavers.com
Mon Apr 25 10:29:35 CDT 2016


Signed-off-by: Aric Stewart <aric at codeweavers.com>


On 4/23/16 1:03 PM, Marcus Meissner wrote:
> 1358558 Resource leak
> 
> (actually switch on the enum, then the compiler will see missing cases)
> 
> 2nd try, also use variable in debug directly
> 
> Signed-off-by: Marcus Meissner <marcus at jet.franken.de>
> ---
>   dlls/hidclass.sys/pnp.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
> index d97184f..87b19ac 100644
> --- a/dlls/hidclass.sys/pnp.c
> +++ b/dlls/hidclass.sys/pnp.c
> @@ -292,10 +292,9 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
>           case IRP_MN_QUERY_ID:
>           {
>               BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
> -            ULONG type = irpsp->Parameters.QueryId.IdType;
>               WCHAR *id = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*REGSTR_VAL_MAX_HCID_LEN);
> -            TRACE("IRP_MN_QUERY_ID[%i]\n", type);
> -            switch (type)
> +            TRACE("IRP_MN_QUERY_ID[%i]\n", irpsp->Parameters.QueryId.IdType);
> +            switch (irpsp->Parameters.QueryId.IdType)
>               {
>                   case BusQueryHardwareIDs:
>                   case BusQueryCompatibleIDs:
> @@ -326,6 +325,10 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
>                       irp->IoStatus.Information = (ULONG_PTR)id;
>                       rc = STATUS_SUCCESS;
>                       break;
> +                case BusQueryDeviceSerialNumber:
> +                    FIXME("BusQueryDeviceSerialNumber not implemented\n");
> +                    HeapFree(GetProcessHeap(), 0, id);
> +                    break;
>               }
>               break;
>           }
> 



More information about the wine-devel mailing list