diff options
-rw-r--r-- | include/utils/SkRTConf.h | 1 | ||||
-rw-r--r-- | src/utils/SkRTConf.cpp | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/include/utils/SkRTConf.h b/include/utils/SkRTConf.h index 37e3259d68..4ba607011d 100644 --- a/include/utils/SkRTConf.h +++ b/include/utils/SkRTConf.h @@ -74,6 +74,7 @@ protected: class SkRTConfRegistry { public: SkRTConfRegistry(); + ~SkRTConfRegistry(); void printAll(const char *fname = NULL) const; bool hasNonDefault() const; void printNonDefault(const char *fname = NULL) const; diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp index b871374d38..bb6cb23cb9 100644 --- a/src/utils/SkRTConf.cpp +++ b/src/utils/SkRTConf.cpp @@ -44,8 +44,8 @@ SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) { continue; } - SkString* key = new SkString(keyptr); - SkString* val = new SkString(valptr); + SkString* key = SkNEW_ARGS(SkString,(keyptr)); + SkString* val = SkNEW_ARGS(SkString,(valptr)); fConfigFileKeys.append(1, &key); fConfigFileValues.append(1, &val); @@ -53,6 +53,20 @@ SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) { sk_fclose(fp); } +SkRTConfRegistry::~SkRTConfRegistry() { + ConfMap::Iter iter(fConfs); + SkTDArray<SkRTConfBase *> *confArray; + + while (iter.next(&confArray)) { + delete confArray; + } + + for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { + SkDELETE(fConfigFileKeys[i]); + SkDELETE(fConfigFileValues[i]); + } +} + const char *SkRTConfRegistry::configFileLocation() const { return "skia.conf"; // for now -- should probably do something fancier like home directories or whatever. } |