Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1901)

Unified Diff: src/utils/SkRTConf.cpp

Issue 136963004: fix leaks in SkConf (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/utils/SkRTConf.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkRTConf.cpp
diff --git a/src/utils/SkRTConf.cpp b/src/utils/SkRTConf.cpp
index b871374d3822b1b3d9746462c60e31c9555cdb6a..bb6cb23cb93c366d29f6bc961907b2a83cece592 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.
}
« no previous file with comments | « include/utils/SkRTConf.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698