[ofw] memory leak on error flow in winmad and winverb

Hefty, Sean sean.hefty at intel.com
Tue Nov 16 12:51:43 PST 2010


> While debugging a BS in winmad I see that a bug with WmCreateControlDevice
> function. When WdfDeviceCreateSymbolicLink and other operation is failed,
> the code calls to WdfObjectDelete but doesn't free the WDF init object

>From the docs:

"If your driver receives a WDFDEVICE_INIT structure from a call to WdfPdoInitAllocate or WdfControlDeviceInitAllocate, and if the driver subsequently encounters an error when it calls a device object initialization method or WdfDeviceCreate, the driver must call WdfDeviceInitFree."

"After the driver calls WdfDeviceCreate, it can no longer access the WDFDEVICE_INIT structure"

I interpret this to mean that once WdfDeviceCreate() succeeds, then there cannot be a call to WdfDeviceInitFree().

- Sean



More information about the ofw mailing list