From abec145b0403af013e5176b0d8b2972d03d00fa4 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 9 Sep 2019 09:41:28 +0000 Subject: [PATCH] dawn_wire: Fix leak in Server::DoDevicePopErrorScope Also fixes a uint64_t -> uint32_t narrowing conversion. Bug: chromium:1001045, dawn:153 Change-Id: I0f94d201884071325c7c5bb40a8c9c67c066e251 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10980 Commit-Queue: Corentin Wallez Reviewed-by: Corentin Wallez --- src/dawn_wire/server/Server.h | 2 +- src/dawn_wire/server/ServerDevice.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dawn_wire/server/Server.h b/src/dawn_wire/server/Server.h index efbb46730a..5e9c8b608a 100644 --- a/src/dawn_wire/server/Server.h +++ b/src/dawn_wire/server/Server.h @@ -36,7 +36,7 @@ namespace dawn_wire { namespace server { Server* server; // TODO(enga): ObjectHandle device; // when the wire supports multiple devices. - uint32_t requestSerial; + uint64_t requestSerial; }; struct FenceCompletionUserdata { diff --git a/src/dawn_wire/server/ServerDevice.cpp b/src/dawn_wire/server/ServerDevice.cpp index 4e86d3e571..8713b57c27 100644 --- a/src/dawn_wire/server/ServerDevice.cpp +++ b/src/dawn_wire/server/ServerDevice.cpp @@ -36,7 +36,11 @@ namespace dawn_wire { namespace server { userdata->server = this; userdata->requestSerial = requestSerial; - return mProcs.devicePopErrorScope(cDevice, ForwardPopErrorScope, userdata); + bool success = mProcs.devicePopErrorScope(cDevice, ForwardPopErrorScope, userdata); + if (!success) { + delete userdata; + } + return success; } // static