boost::scoped_ptr instead of manual pointer lifecycle management.

Change-Id: I3b518065cead1c2805662326f063cb7b24d3d52a