aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2026-05-10 17:44:49 +0000
committertobtoht <tob@featherwallet.org>2026-05-10 17:44:49 +0000
commitf9d202b736929ac7a0737cde7d9dd633d92ab1c7 (patch)
treef876e982fddab9d708702828804f6f64aa9d7add
parent7dd6b5daec9672b9860ae6ff65424780eab9750e (diff)
parente92f9bd2d609b2823c841a4e857fe46f9b7f0ec6 (diff)
downloadmonzero-core-f9d202b736929ac7a0737cde7d9dd633d92ab1c7.tar.gz
monzero-core-f9d202b736929ac7a0737cde7d9dd633d92ab1c7.tar.xz
monzero-core-f9d202b736929ac7a0737cde7d9dd633d92ab1c7.zip
Merge pull request #10568
e92f9bd epee: fix memory leak with readline (ComputeryPony)
-rw-r--r--contrib/epee/src/readline_buffer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp
index ac68d1fdb..76ac9c8b5 100644
--- a/contrib/epee/src/readline_buffer.cpp
+++ b/contrib/epee/src/readline_buffer.cpp
@@ -2,6 +2,7 @@
#include <readline/readline.h>
#include <readline/history.h>
#include <iostream>
+#include <memory>
#include <boost/thread/mutex.hpp>
#include <boost/thread/lock_guard.hpp>
#include <boost/algorithm/string.hpp>
@@ -201,7 +202,7 @@ static void handle_line(char* line)
static bool same_as_last_line(const std::string& test_line)
{
// Note that state->offset == state->length, when a new line was entered.
- HISTORY_STATE* state = history_get_history_state();
+ auto state = std::unique_ptr<HISTORY_STATE, decltype(free)*>{history_get_history_state(), free};
return state->length > 0
&& test_line.compare(state->entries[state->length-1]->line) == 0;
}