aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-04-20 11:01:47 +0930
committerAlan Modra <amodra@gmail.com>2020-04-20 11:09:58 +0930
commita5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6 (patch)
tree2cf993358a3de2429a164bd3a037cb75f8cabcdb /binutils/readelf.c
parent8ff66993e0b57b20067d7a1b6c72a72f4cada2cf (diff)
downloadgdb-a5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6.zip
gdb-a5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6.tar.gz
gdb-a5e0be5cb29bcbcfee6f1ead2daed9889a2a6ac6.tar.bz2
readelf: segfault at readelf.c:12227
This is another one where not cleaning up sufficiently after processing one file can lead to errors when processing the next file. We have ngnuchains non-zero but gnuchains NULL in the following: off < ngnuchains && (gnuchains[off] & 1) == 0 * readelf.c (process_symbol_table): Clear ngnuchains, ngnubuckets and nbuckets.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index d9c9b7e..ea30f88 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12188,6 +12188,7 @@ process_symbol_table (Filedata * filedata)
free (buckets);
buckets = NULL;
+ nbuckets = 0;
free (chains);
chains = NULL;
@@ -12263,8 +12264,10 @@ process_symbol_table (Filedata * filedata)
}
free (gnubuckets);
gnubuckets = NULL;
+ ngnubuckets = 0;
free (gnuchains);
gnuchains = NULL;
+ ngnuchains = 0;
free (mipsxlat);
mipsxlat = NULL;
return TRUE;
@@ -12272,12 +12275,15 @@ process_symbol_table (Filedata * filedata)
err_out:
free (gnubuckets);
gnubuckets = NULL;
+ ngnubuckets = 0;
free (gnuchains);
gnuchains = NULL;
+ ngnuchains = 0
free (mipsxlat);
mipsxlat = NULL;
free (buckets);
buckets = NULL;
+ nbuckets = 0;
free (chains);
chains = NULL;
return FALSE;