mempolicy: fix reference counting bugs