Commit 3e45a732 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Fix a memory leak in MockDrmDevice::CreateDumbBuffer().

Bug: 855588
Change-Id: If19e6d5131fd60796ad524852b5a974e71d8dc4d
Reviewed-on: https://chromium-review.googlesource.com/1112041Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569652}
parent 663129e1
......@@ -334,7 +334,10 @@ bool MockDrmDevice::CreateDumbBuffer(const SkImageInfo& info,
*handle = allocate_buffer_count_++;
*stride = info.minRowBytes();
void* pixels = new char[info.computeByteSize(*stride)];
buffers_.push_back(SkSurface::MakeRasterDirect(info, pixels, *stride));
buffers_.push_back(SkSurface::MakeRasterDirectReleaseProc(
info, pixels, *stride,
[](void* pixels, void* context) { delete[] static_cast<char*>(pixels); },
/*context=*/nullptr));
buffers_[*handle]->getCanvas()->clear(SK_ColorBLACK);
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment