Re: asan: more readelf leaks

In git commit fd486f32d1 I put some static variables used by
get_symbol_for_build_attribute in a file scope ba_cache struct.  This
was to prevent leaks in get_symbol_for_build_attribute, and to tidy up
before readelf exited.  The patch wasn't quite right though.  When
readelf processes more than one file it was possible to double free
arrays allocated in get_symbol_for_build_attribute.

	* readelf.c (process_file): Clean ba_cache.
This commit is contained in:
Alan Modra
2020-03-14 18:58:11 +10:30
parent 2ac70237d2
commit 1bd6175ae7
2 changed files with 6 additions and 0 deletions

View File

@@ -20571,7 +20571,9 @@ process_file (char * file_name)
free (filedata);
free (ba_cache.strtab);
ba_cache.strtab = NULL;
free (ba_cache.symtab);
ba_cache.symtab = NULL;
ba_cache.filedata = NULL;
return ret;