diff --git a/libtcc.c b/libtcc.c index dc78643c..601999ea 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1094,6 +1094,8 @@ LIBTCCAPI void tcc_delete(TCCState *s1) # endif #endif + if(s1->sym_attrs) tcc_free(s1->sym_attrs); + tcc_free(s1); } diff --git a/tccelf.c b/tccelf.c index 036dba3a..6bde7d5f 100644 --- a/tccelf.c +++ b/tccelf.c @@ -2444,6 +2444,7 @@ static int elf_output_file(TCCState *s1, const char *filename) tcc_free(sec_order); tcc_free(phdr); tcc_free(s1->sym_attrs); + s1->sym_attrs = NULL; return ret; }