Windows kernel programming, the problem of applying for content space and then releasing it

my driver initially used ExAllocatePool to request a piece of PagedPool memory for pointer P, but in the following process, pointer P changed until it became NULL. At this point, if I call ExFreePool (P) to free up memory space, the blue screen will occur because P is a null pointer, so how can I free up the memory space I applied for before? If you only apply for it without releasing it, it is easy to cause a memory leak.
Thank you for the answer of the great god who is in trouble to know.

CPP c
Mar.23,2021

needs to use a constant to hold the pointer before changing, and then release the space that the constant points to. After the space application is made, the size and address will not change.


you can use a temporary pointer to point to the pointer with space to do the PP-- operation, which is usually like this

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b41d6c-2be1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b41d6c-2be1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?