Switch SkAutoMalloc to SkAutoTMalloc to avoid cast

Make SkAutoTMalloc's interface look more like SkAutoMalloc:
- add free(), which does what you expect
- make reset() return a pointer fPtr

No public API changes (SkAutoTMalloc is in include/private)

BUG=skia:2148

Review URL: https://codereview.chromium.org/1516833003
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index ef55a8f..2677b13 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -378,8 +378,8 @@
 
             SkAutoLockPixels alp(*bm);
 
-            SkAutoMalloc storage(innerWidth);
-            uint8_t* scanline = (uint8_t*) storage.get();
+            SkAutoTMalloc<uint8_t> storage(innerWidth);
+            uint8_t* scanline = storage.get();
 
             // GIF has an option to store the scanlines of an image, plus a larger background,
             // filled by a fill color. In this case, we will use a subset of the larger bitmap
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 219dad6..0d02a65 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -496,8 +496,8 @@
         return return_failure(cinfo, *bm, "sampler.begin");
     }
 
-    SkAutoMalloc srcStorage(cinfo.output_width * srcBytesPerPixel);
-    uint8_t* srcRow = (uint8_t*)srcStorage.get();
+    SkAutoTMalloc<uint8_t> srcStorage(cinfo.output_width * srcBytesPerPixel);
+    uint8_t* srcRow = srcStorage.get();
 
     //  Possibly skip initial rows [sampler.srcY0]
     if (!skip_src_rows(&cinfo, srcRow, sampler.srcY0())) {
@@ -931,7 +931,7 @@
         skjpeg_destination_mgr  sk_wstream(stream);
 
         // allocate these before set call setjmp
-        SkAutoMalloc    oneRow;
+        SkAutoTMalloc<uint8_t>  oneRow;
 
         cinfo.err = jpeg_std_error(&sk_err);
         sk_err.error_exit = skjpeg_error_exit;
@@ -966,7 +966,7 @@
         jpeg_start_compress(&cinfo, TRUE);
 
         const int       width = bm.width();
-        uint8_t*        oneRowP = (uint8_t*)oneRow.reset(width * 3);
+        uint8_t*        oneRowP = oneRow.reset(width * 3);
 
         const SkPMColor* colors = bm.getColorTable() ? bm.getColorTable()->readColors() : nullptr;
         const void*      srcRow = bm.getPixels();
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 6acbf29..cd8152a 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -401,8 +401,8 @@
         const int height = decodedBitmap->height();
 
         if (number_passes > 1) {
-            SkAutoMalloc storage(origWidth * origHeight * srcBytesPerPixel);
-            uint8_t* base = (uint8_t*)storage.get();
+            SkAutoTMalloc<uint8_t> storage(origWidth * origHeight * srcBytesPerPixel);
+            uint8_t* base = storage.get();
             size_t rowBytes = origWidth * srcBytesPerPixel;
 
             for (int i = 0; i < number_passes; i++) {
@@ -420,8 +420,8 @@
                 base += sampler.srcDY() * rowBytes;
             }
         } else {
-            SkAutoMalloc storage(origWidth * srcBytesPerPixel);
-            uint8_t* srcRow = (uint8_t*)storage.get();
+            SkAutoTMalloc<uint8_t> storage(origWidth * srcBytesPerPixel);
+            uint8_t* srcRow = storage.get();
             skip_src_rows(png_ptr, srcRow, sampler.srcY0());
 
             for (int y = 0; y < height; y++) {
@@ -966,8 +966,8 @@
     png_write_info(png_ptr, info_ptr);
 
     const char* srcImage = (const char*)bitmap.getPixels();
-    SkAutoSMalloc<1024> rowStorage(bitmap.width() << 2);
-    char* storage = (char*)rowStorage.get();
+    SkAutoSTMalloc<1024, char> rowStorage(bitmap.width() << 2);
+    char* storage = rowStorage.get();
     transform_scanline_proc proc = choose_proc(ct, hasAlpha);
 
     for (int y = 0; y < bitmap.height(); y++) {
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 07ff83d..5253577 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -201,8 +201,8 @@
     }
     const size_t readBufferSize = stream->hasLength() ?
             SkTMin(stream->getLength(), WEBP_IDECODE_BUFFER_SZ) : WEBP_IDECODE_BUFFER_SZ;
-    SkAutoMalloc srcStorage(readBufferSize);
-    unsigned char* input = (uint8_t*)srcStorage.get();
+    SkAutoTMalloc<unsigned char> srcStorage(readBufferSize);
+    unsigned char* input = srcStorage.get();
     if (nullptr == input) {
         WebPIDelete(idec);
         WebPFreeDecBuffer(&config->output);