History

A possible fix for the memory leak reported by valgrind when running tcctest.c with tcc.

mingodad committed 12 years ago

Commit ad956801 parent dc8ea932 files · +3 −0Browse files

Unified · Split

2 files
  1. libtcc.c +2 −0
  2. tccelf.c +1 −0
libtcc.c+2−0
@@ -1094,6 +1094,8 @@ LIBTCCAPI void tcc_delete(TCCState *s1) · 1093 unmodified lines
10941094 # endif
10951095 #endif
10961096
1097+ if(s1->sym_attrs) tcc_free(s1->sym_attrs);
1098+
10971099 tcc_free(s1);
10981100 }
10991101
tccelf.c+1−0
@@ -2444,6 +2444,7 @@ static int elf_output_file(TCCState *s1, const char *filename) · 2443 unmodified lines
24442444 tcc_free(sec_order);
24452445 tcc_free(phdr);
24462446 tcc_free(s1->sym_attrs);
2447+ s1->sym_attrs = NULL;
24472448 return ret;
24482449 }
24492450