aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkReadBuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkReadBuffer.h')
-rw-r--r--src/core/SkReadBuffer.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h
index 0653ab6865..980e8cf80f 100644
--- a/src/core/SkReadBuffer.h
+++ b/src/core/SkReadBuffer.h
@@ -165,11 +165,11 @@ public:
sk_sp<SkData> readByteArrayAsData() {
size_t len = this->getArrayCount();
- if (!this->validateAvailable(len)) {
+ void* buffer = sk_malloc_throw(len);
+ if (!this->readByteArray(buffer, len)) {
+ sk_free(buffer);
return SkData::MakeEmpty();
}
- void* buffer = sk_malloc_throw(len);
- this->readByteArray(buffer, len);
return SkData::MakeFromMalloc(buffer, len);
}