Fix some memory leaks.
Merge branch '20141016-hwpmc-leak' into markj-develop