aaf6f6215f
Fix a couple of memory related errors. Also fix thread test failures. Change-Id: I0103995f832cecf1dd2380000321ac7204f0cfc0