Fix memory leak in SkPDFResourceDict
R=vandebo@chromium.org, edisonn@google.com
Author: richardlin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/20655004
git-svn-id: http://skia.googlecode.com/svn/trunk@10499 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFResourceDict.cpp b/src/pdf/SkPDFResourceDict.cpp
index ee44f4e..0102b3c 100644
--- a/src/pdf/SkPDFResourceDict.cpp
+++ b/src/pdf/SkPDFResourceDict.cpp
@@ -112,14 +112,15 @@
SkPDFDict* typeDict = fTypes[type];
if (NULL == typeDict) {
SkAutoTUnref<SkPDFDict> newDict(SkNEW(SkPDFDict()));
- SkPDFName* typeName = SkNEW_ARGS(
- SkPDFName, (get_resource_type_name(type)));
+ SkAutoTUnref<SkPDFName> typeName(
+ SkNEW_ARGS(SkPDFName, (get_resource_type_name(type))));
insert(typeName, newDict); // ref counting handled here
fTypes[type] = newDict;
typeDict = newDict.get();
}
- SkPDFName* keyName = SkNEW_ARGS(SkPDFName, (getResourceName(type, key)));
+ SkAutoTUnref<SkPDFName> keyName(
+ SkNEW_ARGS(SkPDFName, (getResourceName(type, key))));
typeDict->insert(keyName, value);
return value;
}