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

Side by Side Diff: src/pdf/SkPDFResourceDict.cpp

Issue 20655004: Fix memory leak in SkPDFResourceDict (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPDFResourceDict.h" 8 #include "SkPDFResourceDict.h"
9 #include "SkPostConfig.h" 9 #include "SkPostConfig.h"
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 SkString keyString; 105 SkString keyString;
106 keyString.printf("%c%d", get_resource_type_prefix(type), key); 106 keyString.printf("%c%d", get_resource_type_prefix(type), key);
107 return keyString; 107 return keyString;
108 } 108 }
109 109
110 SkPDFObject* SkPDFResourceDict::insertResource( 110 SkPDFObject* SkPDFResourceDict::insertResource(
111 SkPDFResourceType type, int key, SkPDFObject* value) { 111 SkPDFResourceType type, int key, SkPDFObject* value) {
112 SkPDFDict* typeDict = fTypes[type]; 112 SkPDFDict* typeDict = fTypes[type];
113 if (NULL == typeDict) { 113 if (NULL == typeDict) {
114 SkAutoTUnref<SkPDFDict> newDict(SkNEW(SkPDFDict())); 114 SkAutoTUnref<SkPDFDict> newDict(SkNEW(SkPDFDict()));
115 SkPDFName* typeName = SkNEW_ARGS( 115 SkAutoTUnref<SkPDFName> typeName(
116 SkPDFName, (get_resource_type_name(type))); 116 SkNEW_ARGS(SkPDFName, (get_resource_type_name(type))));
117 insert(typeName, newDict); // ref counting handled here 117 insert(typeName, newDict); // ref counting handled here
118 fTypes[type] = newDict; 118 fTypes[type] = newDict;
119 typeDict = newDict.get(); 119 typeDict = newDict.get();
120 } 120 }
121 121
122 SkPDFName* keyName = SkNEW_ARGS(SkPDFName, (getResourceName(type, key))); 122 SkAutoTUnref<SkPDFName> keyName(
123 SkNEW_ARGS(SkPDFName, (getResourceName(type, key))));
123 typeDict->insert(keyName, value); 124 typeDict->insert(keyName, value);
124 return value; 125 return value;
125 } 126 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698