What are the right places to allocate/de-allocate memory for global
variables in AVStream drivers?
At the moment I'm allocating memory inside DriverEntry right after
KsInitializeDriver call and de-allocate inside the hook for
'DriverUnload', which I installed also after KsInitializeDriver call.
Is it correct way of working with global variables? I'm asking because
from time to time I'm getting BSODs with the following error:
The current thread is making a bad pool request. Typically this is at
a bad IRQL level or double freeing the same allocation, etc.
Arg1: 0000000000000007, Attempt to free pool which was already freed
Arg2: 000000000000126c, (reserved)
Arg3: 0000000000080008, Memory contents of the pool block
Arg4: ffffe000f8f23f10, Address of the block of pool being deallocated
Based on the stack trace it is caused by my attempt to de-allocate
global variable. So it looks like this memory might have been already
freed by someone else, but the issue is that there should be no
'someone else'. Is there any driver-related magic involved here, like
'all the non-paged pool allocations gets unallocated automatically by
the time of DriverUnload' or something like this? What is the
recommended way of working with driver-global (not filter-specific)
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
URL to WDMAUDIODEV page: