From 29cd42e01912a748bac0b483462e4373c0207870 Mon Sep 17 00:00:00 2001 From: Dmitriy Anisimkov Date: Sun, 29 Nov 2020 23:21:58 +0600 Subject: [Ada] Fix memory leak in GNAT.Expect.Non_Blocking_Spawn on Windows gcc/ada/ * libgnat/g-expect.adb (Non_Blocking_Spawn): Deallocate elements on Arg_List after calling Set_Up_Child_Communications. --- gcc/ada/libgnat/g-expect.adb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc') diff --git a/gcc/ada/libgnat/g-expect.adb b/gcc/ada/libgnat/g-expect.adb index 78b3c27..0f9d0b9 100644 --- a/gcc/ada/libgnat/g-expect.adb +++ b/gcc/ada/libgnat/g-expect.adb @@ -1181,6 +1181,12 @@ package body GNAT.Expect is Set_Up_Child_Communications (Descriptor, Pipe1, Pipe2, Pipe3, Command_With_Path.all, C_Arg_List'Address); + + -- On Windows systems we need to release memory taken for Arg_List + + for A of Arg_List loop + Free (A); + end loop; end if; Free (Command_With_Path); -- cgit v1.1