From c05acf829f458d83109ed6e715e59c8d509db030 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Mon, 16 Mar 2020 22:13:21 -0400 Subject: [PATCH] fix potential leak in OC's wrapped_fd move assignment op --- .../include/eosio/chain/webassembly/eos-vm-oc/ipc_helpers.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/ipc_helpers.hpp b/libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/ipc_helpers.hpp index 929bc19d66f..fcb58537311 100644 --- a/libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/ipc_helpers.hpp +++ b/libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/ipc_helpers.hpp @@ -19,6 +19,8 @@ class wrapped_fd { wrapped_fd& operator=(const wrapped_fd&) = delete; wrapped_fd(wrapped_fd&& other) : _inuse(other._inuse), _fd(other._fd) {other._inuse = false;} wrapped_fd& operator=(wrapped_fd&& other) { + if(_inuse) + close(_fd); _inuse = other._inuse; _fd = other._fd; other._inuse = false;