Index: src/core/SkPictureData.cpp |
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp |
index fc4fdb8230d14655555b8ab35c4d4cf5beb8a2de..4f3ac37066f9197c362d9b0f7b6ac533306d070e 100644 |
--- a/src/core/SkPictureData.cpp |
+++ b/src/core/SkPictureData.cpp |
@@ -373,26 +373,14 @@ bool SkPictureData::parseStreamTag(SkStream* stream, |
} |
} break; |
case SK_PICT_PICTURE_TAG: { |
- fPictureCount = size; |
- fPictureRefs = SkNEW_ARRAY(const SkPicture*, fPictureCount); |
- bool success = true; |
- int i = 0; |
- for ( ; i < fPictureCount; i++) { |
+ fPictureCount = 0; |
+ fPictureRefs = SkNEW_ARRAY(const SkPicture*, size); |
+ for (uint32_t i = 0; i < size; i++) { |
fPictureRefs[i] = SkPicture::CreateFromStream(stream, proc); |
- if (NULL == fPictureRefs[i]) { |
- success = false; |
- break; |
- } |
- } |
- if (!success) { |
- // Delete all of the pictures that were already created (up to but excluding i): |
- for (int j = 0; j < i; j++) { |
- fPictureRefs[j]->unref(); |
+ if (!fPictureRefs[i]) { |
+ return false; |
} |
- // Delete the array |
- SkDELETE_ARRAY(fPictureRefs); |
- fPictureCount = 0; |
- return false; |
+ fPictureCount++; |
} |
} break; |
case SK_PICT_BUFFER_SIZE_TAG: { |