From 76c62139c8dfc298c525fe5789b6036563bddf38 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 20 Jan 2022 21:48:13 +0100 Subject: [PATCH] Fix tiny memory leak when pasting multple files --- gtk2_ardour/utils.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 62c8084619..7dacebf109 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -890,7 +890,10 @@ ARDOUR_UI_UTILS::convert_drop_to_paths (vector& paths, const SelectionDa */ string txt = data.get_text(); - char* p = (char *) malloc (txt.length() + 1); + /* copy to char* for easy char-wise checks and modification */ + char* tmp = (char *) malloc (txt.length() + 1); + char* p = tmp; + txt.copy (p, txt.length(), 0); p[txt.length()] = '\0'; @@ -922,7 +925,7 @@ ARDOUR_UI_UTILS::convert_drop_to_paths (vector& paths, const SelectionDa } } - free ((void*)p); + free ((void*)tmp); if (uris.empty()) { return false;