No it doesn't leak because they're parameters/arguments. You only need to destroy/null local/global variables (globals don't have to be nulled because you can't ever lose the reference to that variable).
Attached a testmap so you can play around and see for yourself :)
However most people don't like using locations because they can leak.
Here are 2 commonly used alternatives:
function DistanceBetweenXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)))
function DistanceBetweenUnits takes unit a, unit b returns real
return SquareRoot(((GetUnitX(b) - GetUnitX(a)) * (GetUnitX(b) - GetUnitX(a))) + ((GetUnitY(b) - GetUnitY(a)) * (GetUnitY(b) - GetUnitY(a))))