DescriptionGet rid of leaks in SkCodec::NewFromStream.
SkCodec::NewFromStream claims to delete the passed in SkStream on
failure. This allows the caller to pass an SkStream to the function
and not worry about deleting it depending on the return value.
Most of our SkCodecs did not honor this contract though. Update them
to delete the stream on failure. Further, update SkCodec::NewFromStream
to delete the stream if it did not match any subclass, and delete the
SkCodec if we decided to return NULL because it was too big.
Add a test which tests streams which represent the beginnings of
supported format types but do not contain enough data to create an
SkCodec. The interesting part of the test is when we run it on ASAN,
which will report that we leaked something without the other changes.
BUG=skia:3257
Committed: https://skia.googlesource.com/skia/+/0a7e69cb9b4e3929d659891d152a2c0b59bff4e0
Patch Set 1 #
Total comments: 2
Patch Set 2 : Add comment that ReadHeader does not own SkStream. #
Messages
Total messages: 14 (4 generated)
|