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

Side by Side Diff: src/ports/SkFontHost_fontconfig.cpp

Issue 16525003: Fix leak in SkFontHost_fontconfig temporary code. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: My fingers forgot to type 'detatch'. Created 7 years, 6 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 2008 Google Inc. 2 * Copyright 2008 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 "SkFontConfigInterface.h" 8 #include "SkFontConfigInterface.h"
9 #include "SkFontConfigTypeface.h" 9 #include "SkFontConfigTypeface.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 size_t length = stream->getLength(); 147 size_t length = stream->getLength();
148 148
149 const void* memory = stream->getMemoryBase(); 149 const void* memory = stream->getMemoryBase();
150 if (NULL != memory) { 150 if (NULL != memory) {
151 return new SkMemoryStream(memory, length, true); 151 return new SkMemoryStream(memory, length, true);
152 } 152 }
153 153
154 SkAutoTMalloc<uint8_t> allocMemory(length); 154 SkAutoTMalloc<uint8_t> allocMemory(length);
155 stream->rewind(); 155 stream->rewind();
156 if (length == stream->read(allocMemory.get(), length)) { 156 if (length == stream->read(allocMemory.get(), length)) {
157 return new SkMemoryStream(allocMemory.detach(), length); 157 SkAutoTUnref<SkMemoryStream> copyStream(new SkMemoryStream());
158 copyStream->setMemoryOwned(allocMemory.detach(), length);
159 return copyStream.detach();
158 } 160 }
159 161
160 stream->rewind(); 162 stream->rewind();
161 stream->ref(); 163 stream->ref();
162 } else { 164 } else {
163 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI()); 165 SkAutoTUnref<SkFontConfigInterface> fci(RefFCI());
164 if (NULL == fci.get()) { 166 if (NULL == fci.get()) {
165 return NULL; 167 return NULL;
166 } 168 }
167 stream = fci->openStream(this->getIdentity()); 169 stream = fci->openStream(this->getIdentity());
(...skipping 20 matching lines...) Expand all
188 : 0; 190 : 0;
189 } 191 }
190 192
191 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc, 193 void FontConfigTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
192 bool* isLocalStream) const { 194 bool* isLocalStream) const {
193 desc->setFamilyName(this->getFamilyName()); 195 desc->setFamilyName(this->getFamilyName());
194 *isLocalStream = SkToBool(this->getLocalStream()); 196 *isLocalStream = SkToBool(this->getLocalStream());
195 } 197 }
196 198
197 /////////////////////////////////////////////////////////////////////////////// 199 ///////////////////////////////////////////////////////////////////////////////
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