aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDmitriy Anisimkov <anisimko@adacore.com>2020-11-29 23:21:58 +0600
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-16 08:01:04 -0500
commit29cd42e01912a748bac0b483462e4373c0207870 (patch)
treeeffbe6e62d3883f23027b92653b8c7c4397d4952 /gcc
parent64f4351d83fedbfffc2a4ccdbd5e423ff7fa3958 (diff)
downloadgcc-29cd42e01912a748bac0b483462e4373c0207870.zip
gcc-29cd42e01912a748bac0b483462e4373c0207870.tar.gz
gcc-29cd42e01912a748bac0b483462e4373c0207870.tar.bz2
[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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/g-expect.adb6
1 files changed, 6 insertions, 0 deletions
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);