From 75ca7c181fdcb6f28380cb8e128236c627932450 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 23 Jan 2026 22:20:23 +0100 Subject: [PATCH 1/3] [winpr,wlog] remove duplicate wlog destroy --- winpr/libwinpr/utils/wlog/wlog.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index ef4482217..e70fd22f7 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -74,10 +74,6 @@ static BOOL WLog_ParseFilter(wLog* root, wLogFilter* filter, LPCSTR name); static BOOL WLog_ParseFilters(wLog* root); static wLog* WLog_Get_int(wLog* root, LPCSTR name); -#if !defined(_WIN32) -static void WLog_Uninit_(void) __attribute__((destructor)); -#endif - static void WLog_Uninit_(void) { wLog* child = NULL; From dde93d1aa23b0382cde01605862fe80976d41504 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 23 Jan 2026 22:05:08 +0100 Subject: [PATCH 2/3] [utils,signal] unregister signal handler on termination --- libfreerdp/utils/signal.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/libfreerdp/utils/signal.c b/libfreerdp/utils/signal.c index 346cd9855..cefe975df 100644 --- a/libfreerdp/utils/signal.c +++ b/libfreerdp/utils/signal.c @@ -195,6 +195,35 @@ static BOOL register_handlers(const int* signals, size_t count, void (*handler)( return TRUE; } +static void unregister_handlers(const int* signals, size_t count) +{ + WINPR_ASSERT(signals || (count == 0)); + + sigset_t orig_set = { 0 }; + struct sigaction saction = { 0 }; + + pthread_sigmask(SIG_BLOCK, &(saction.sa_mask), &orig_set); + + sigfillset(&(saction.sa_mask)); + sigdelset(&(saction.sa_mask), SIGCONT); + + saction.sa_handler = SIG_IGN; + saction.sa_flags = 0; + + for (size_t x = 0; x < count; x++) + { + sigaction(signals[x], &saction, NULL); + } + + pthread_sigmask(SIG_SETMASK, &orig_set, NULL); +} + +static void unregister_all_handlers(void) +{ + unregister_handlers(fatal_signals, ARRAYSIZE(fatal_signals)); + unregister_handlers(term_signals, ARRAYSIZE(term_signals)); +} + int freerdp_handle_signals(void) { int rc = -1; @@ -203,6 +232,7 @@ int freerdp_handle_signals(void) WLog_DBG(TAG, "Registering signal hook..."); + (void)atexit(unregister_all_handlers); if (!register_handlers(fatal_signals, ARRAYSIZE(fatal_signals), fatal_handler)) goto fail; if (!register_handlers(term_signals, ARRAYSIZE(term_signals), term_handler)) From ea419300b745e1843cd0992681149b426dcc4db3 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 23 Jan 2026 22:33:27 +0100 Subject: [PATCH 3/3] [client,common] fix memory leak in rdpParser When duplicate lines are found in a RDP file the old entry was not freed up. --- client/common/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/common/file.c b/client/common/file.c index 4c9eda34d..e74a9255a 100644 --- a/client/common/file.c +++ b/client/common/file.c @@ -716,6 +716,9 @@ static BOOL freerdp_client_rdp_file_set_string(rdpFile* file, const char* name, if (targetValue) { + if ((uintptr_t)(*targetValue) != UINTPTR_MAX) + free(*targetValue); + *targetValue = _strdup(value); if (!(*targetValue)) return FALSE;