core: fix compiler warning and a rare mem leak

	* setting the global advertised port multiple times leaked pkg mem