Fix memleaks on master and wall processes