Delete gm after use.

Fixes a memory leak when using the --modulo flag. Instead of deleting
manually in each case we are done with it (which led to missing one
case), use an SkAutoTDelete.

Review URL: https://codereview.chromium.org/13929019

git-svn-id: http://skia.googlecode.com/svn/trunk@8707 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index a91a28f..4979d79 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1807,7 +1807,7 @@
     Iter iter;
     GM* gm;
     while ((gm = iter.next()) != NULL) {
-
+        SkAutoTDelete<GM> adgm(gm);
         ++gmIndex;
         if (moduloRemainder >= 0) {
             if ((gmIndex % moduloDivisor) != moduloRemainder) {
@@ -1818,7 +1818,6 @@
 
         const char* shortName = gm->shortName();
         if (skip_name(FLAGS_match, shortName)) {
-            SkDELETE(gm);
             continue;
         }
 
@@ -1837,8 +1836,6 @@
         // TODO(epoger): only run this if gmmain.generate_image() succeeded?
         // Otherwise, what are we comparing against?
         run_multiple_modes(gmmain, gm, compareConfig, comparisonBitmap, tileGridReplayScales);
-
-        SkDELETE(gm);
     }
 
     SkTArray<SkString> modes;