fix memory leaks



git-svn-id: http://skia.googlecode.com/svn/trunk@1448 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/forth/Forth.cpp b/forth/Forth.cpp
index 01ed204..1df9dd8 100644
--- a/forth/Forth.cpp
+++ b/forth/Forth.cpp
@@ -277,6 +277,11 @@
 }
 
 ForthParser::~ForthParser() {
+    SkTDict<ForthWord*>::Iter iter(fDict);
+    ForthWord* word;
+    while (iter.next(&word)) {
+        delete word;
+    }
 }
 
 static const char* parse_error(const char msg[]) {
diff --git a/forth/ForthParser.h b/forth/ForthParser.h
index 65a39a1..706e95b 100644
--- a/forth/ForthParser.h
+++ b/forth/ForthParser.h
@@ -21,7 +21,8 @@
     void add(const char name[], size_t len, ForthWord* word) {
     //    SkString str(name, len);
     //    SkDebugf("add %s %p\n", str.c_str(), word);
-        (void)fDict.set(name, len, word);
+        SkDEBUGCODE(bool isNewWord = )fDict.set(name, len, word);
+        SkASSERT(isNewWord);
     }
 
     ForthWord* find(const char name[], size_t len) const {
diff --git a/forth/SampleForth.cpp b/forth/SampleForth.cpp
index cfd1172..c0a0c75 100644
--- a/forth/SampleForth.cpp
+++ b/forth/SampleForth.cpp
@@ -188,6 +188,10 @@
 #endif
     }
     
+    virtual ~ForthView() {
+        SkDebugf("");
+    }
+
 protected:
     // overrides from SkEventSink
     virtual bool onQuery(SkEvent* evt) {
diff --git a/forth/StdWords.cpp b/forth/StdWords.cpp
index 177dabd..bd11180 100644
--- a/forth/StdWords.cpp
+++ b/forth/StdWords.cpp
@@ -428,7 +428,6 @@
     this->add("fabs", 4, new fabs_ForthWord);
     this->add("fmin", 4, new fmin_ForthWord);
     this->add("fmax", 4, new fmax_ForthWord);
-    this->add("fmax", 4, new fmax_ForthWord);
     this->add("floor", 5, new floor_ForthWord);
     this->add("ceil", 4, new ceil_ForthWord);
     this->add("round", 5, new round_ForthWord);
diff --git a/samplecode/SampleDraw.cpp b/samplecode/SampleDraw.cpp
index 54070d1..deb1fb2 100644
--- a/samplecode/SampleDraw.cpp
+++ b/samplecode/SampleDraw.cpp
@@ -262,6 +262,7 @@
     virtual ~DrawView() {
         fList.unrefAll();
         SkSafeUnref(fDraw);
+        delete fFactory;
     }
 
     Draw* setDraw(Draw* d) {
diff --git a/samplecode/SampleGM.cpp b/samplecode/SampleGM.cpp
index 2f9f046..ec5b22a 100644
--- a/samplecode/SampleGM.cpp
+++ b/samplecode/SampleGM.cpp
@@ -54,7 +54,11 @@
         
         this->setBGColor(0xFFDDDDDD);
     }
-    
+
+    virtual ~GMView() {
+        delete fGM;
+    }
+
 protected:
     // overrides from SkEventSink
     virtual bool onQuery(SkEvent* evt) {