From 2f8918f5d0504a1d55193519904d7f23b7411017 Mon Sep 17 00:00:00 2001 From: Vladimir Bayrashevskiy Date: Thu, 26 Jan 2023 14:14:15 +0700 Subject: [PATCH] Fix memory leak inside the move assignment operator of rust::Error class --- src/cxx.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cxx.cc b/src/cxx.cc index a7cb6797e..4958eb08b 100644 --- a/src/cxx.cc +++ b/src/cxx.cc @@ -488,6 +488,7 @@ Error &Error::operator=(const Error &other) & { Error &Error::operator=(Error &&other) &noexcept { std::exception::operator=(std::move(other)); + delete[] this->msg; this->msg = other.msg; this->len = other.len; other.msg = nullptr;