Index: src/pdf/SkPDFFont.cpp |
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp |
index 9e13053c60db85de10d61ed01637c8a89fb08473..b4e6d98722ab61d029e324748c2c6a19d5117458 100644 |
--- a/src/pdf/SkPDFFont.cpp |
+++ b/src/pdf/SkPDFFont.cpp |
@@ -204,16 +204,15 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen, |
SkASSERT(length > 0); |
SkASSERT(length + (2 * kPFBSectionHeaderLength) <= srcLen); |
- SkAutoTMalloc<uint8_t> buffer(length); |
+ SkData* data = SkData::NewUninitialized(length); |
const uint8_t* const srcHeader = src + kPFBSectionHeaderLength; |
// There is a six-byte section header before header and data |
// (but not trailer) that we're not going to copy. |
- const uint8_t* const srcData |
- = srcHeader + *headerLen + kPFBSectionHeaderLength; |
+ const uint8_t* const srcData = srcHeader + *headerLen + kPFBSectionHeaderLength; |
const uint8_t* const srcTrailer = srcData + *headerLen; |
- uint8_t* const resultHeader = buffer.get(); |
+ uint8_t* const resultHeader = (uint8_t*)data->writable_data(); |
uint8_t* const resultData = resultHeader + *headerLen; |
uint8_t* const resultTrailer = resultData + *dataLen; |
@@ -223,7 +222,7 @@ static SkData* handle_type1_stream(SkStream* srcStream, size_t* headerLen, |
memcpy(resultData, srcData, *dataLen); |
memcpy(resultTrailer, srcTrailer, *trailerLen); |
- return SkData::NewFromMalloc(buffer.detach(), length); |
+ return data; |
} |
// A PFA has to be converted for PDF. |