Avoid possible resource leaks by boost::scoped_array

Change-Id: I4287fa05e35c132fb6e11d95dd17c3d3bf29defc