replace all instances of Scoped{Ptr,Array} with unique_ptr

Includes a few very minor use cleanups too:

- *foo.Get() is simpler as just *foo
- foo.Get()[idx] is simpler as just foo[idx]
- NULL -> nullptr
- Valid() doesn't have a direct counterpart in unique_ptr; just
  use the pointer in a bool context (it has an explicit conversion
  to bool)
replace ScopedMalloc with a FreeDeleter type for use with unique_ptr