WUtil: Avoid memory leak and misbehaviour on internal function 'getuserhomedir'