C28103

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

warning C28103: Leaking resource

The specified object contains a resource that has not been freed. A function being called has been annotated with __drv_acquiresResource or __drv_acquiresResourceGlobal and this warning indicates that the resource named in the annotation was not freed.

Example

The following code example generates this warning:

res = KeSaveFloatingPointState(buffer);  

The following code example avoids this warning:

res = KeSaveFloatingPointState(buffer);  
if (NT_SUCCESS(res))  
{  
    res = KeRestoreFloatingPointState(buffer);  
}  

If this warning is reported as a false positive, the most likely cause is that the function that releases the resource is not annotated with __drv_releasesResource or __drv_releasesResourceGlobal. Note that if you are using wrapper functions for system functions, the wrapper functions should use the same annotations that the system functions do. Currently, many system functions are annotated in the model file, so the annotations are not visible in the header files.