Warning C28103
Leaking resource
The specified object contains a resource that hasn't 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 wasn't 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 isn't annotated with __drv_releasesResource
or __drv_releasesResourceGlobal
. If you're 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 aren't visible in the header files.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for