First of all,
always null handle local variables when they reach the end of their 'scope', always. Plenty of times, it is not
necessary to null a local. But turning the nulling into a mechanical process while trivializing it is better than having to give thought to such a lame thing... Just to save a couple of lines of code...
However, if this is your typical spell trigger, it is true you don't
have to null it.
First of all, you are not worried about the pointer itself leaking, the reason you null locals is because of the handle's index.
The first thing to notice is that handle indexes are
ref-counted , even if you call a Destructor (IE RemoveLocation) on a handle, its index will remain alive until all references against it are down. When you call a Destructor, a 4 bytes handle "ghost" will remain in its location.
What happens here, is that there is a blizzard bug, references for local variables don't go down automatically when a function's scope ends. So we set them to null so the reference counter goes down, and the index can be recycled (and we can get those 4 bytes back)
The bytes are not an issue unless you have this leak multiple times, however, the indexes are a problem.
JASS:
function err takes nothing returns nothing
local location loc = Location(0, 4.5)
call RemoveLocation(loc)
endfunction
This line of code leaks. We are removing the location
object, however, the bug prevents wc3 to notice loc's index is no longer in use. And thus this index will leak.
JASS:
function err takes nothing returns nothing
local location loc = Location(0, 4.5)
call RemoveLocation(loc)
set loc = null
endfunction
This does not leak anymore.
Anyway,
if the handle held by the variable is not EVER destroyed, then you don't have to null it. That's the real reason that in the case you pointed, you don't need to null the variable.