From cd742f4a165865225a3a6c6d1bd287897994bdd1 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Wed, 23 May 2018 10:24:04 +0000 Subject: [PATCH] [Ada] Fix memory leak in win32_wait error handling 2018-05-23 Pascal Obry gcc/ada/ * adaint.c (win32_wait): Properly free the handle/pid lists when WaitForMultipleObjects fails (return WAIT_FAILED). From-SVN: r260599 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/adaint.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c2df68d1562..e44bdc64bc9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-05-23 Pascal Obry + + * adaint.c (win32_wait): Properly free the handle/pid lists when + WaitForMultipleObjects fails (return WAIT_FAILED). + 2018-05-23 Pascal Obry * adaint.c (win32_wait): Add missing parentheses. diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 07e55e4eb85..552bd4404c3 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -2607,6 +2607,8 @@ win32_wait (int *status) /* If there was an error, exit now */ if (res == WAIT_FAILED) { + free (hl); + free (pidl); errno = EINVAL; return -1; } -- 2.30.2