From 8dc8dbc8211e7b0245a6e7db911265efbe0fccaf Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Fri, 5 Jan 2018 11:20:10 -0500 Subject: begin cleanup of malloc porting layer 1. Merge some of the allocators into sk_malloc_flags by redefining a flag to mean zero-init 2. Add more private helpers to simplify our call-sites (and handle some overflow mul checks) 3. The 2-param helpers rely on the saturating SkSafeMath::Mul to pass max_size_t as the request, which should always fail. Bug:508641 Change-Id: I322f1e6ed91113467e0fdb12c91c3dad33d890c8 Reviewed-on: https://skia-review.googlesource.com/90940 Commit-Queue: Mike Reed Reviewed-by: Robert Phillips Reviewed-by: Stephan Altmueller --- src/core/SkAutoPixmapStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/SkAutoPixmapStorage.cpp') diff --git a/src/core/SkAutoPixmapStorage.cpp b/src/core/SkAutoPixmapStorage.cpp index 47f41e7b92..72194233a8 100644 --- a/src/core/SkAutoPixmapStorage.cpp +++ b/src/core/SkAutoPixmapStorage.cpp @@ -40,7 +40,7 @@ bool SkAutoPixmapStorage::tryAlloc(const SkImageInfo& info) { if (SkImageInfo::ByteSizeOverflowed(size)) { return false; } - void* pixels = sk_malloc_flags(size, 0); + void* pixels = sk_malloc_canfail(size); if (nullptr == pixels) { return false; } -- cgit v1.2.3