Properly Clean up UDP sockets by using function stack instead of memory heap