[gcc r14-6356] driver: Fix memory leak [PR93019]

Jakub Jelinek jakub@gcc.gnu.org
Sat Dec 9 09:30:19 GMT 2023


https://gcc.gnu.org/g:36be2a0e91c76da4afcd5ddc37e03f5800396387

commit r14-6356-g36be2a0e91c76da4afcd5ddc37e03f5800396387
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Dec 9 10:28:37 2023 +0100

    driver: Fix memory leak [PR93019]
    
    driver:finalize used by JIT clears the mdswitches pointer; if it was
    allocated before, that leaks the memory.
    
    2023-12-09  Costas Argyris  <costas.argyris@gmail.com>
                Jakub Jelinek  <jakub@redhat.com>
    
            PR driver/93019
            * gcc.cc (driver::finalize): Call XDELETEVEC on mdswitches before
            clearing it.
    
    Signed-off-by: Costas Argyris <costas.argyris@gmail.com>

Diff:
---
 gcc/gcc.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index d73fb0414e9..701f5cdfb59 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -11368,6 +11368,7 @@ driver::finalize ()
   input_from_pipe = 0;
   suffix_subst = NULL;
 
+  XDELETEVEC (mdswitches);
   mdswitches = NULL;
   n_mdswitches = 0;


More information about the Gcc-cvs mailing list