diff options
author | David Faust <david.faust@oracle.com> | 2024-11-07 09:19:51 -0800 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2024-11-07 09:57:25 -0800 |
commit | 6571e8f863736b7705f59c9ab0f17b7c4fdbcf92 (patch) | |
tree | 19377bc9088f9345689172701dc40bec55d036f2 | |
parent | 2a2e6784074e1f7b679bc09b1a66982bf60645a5 (diff) | |
download | gcc-6571e8f863736b7705f59c9ab0f17b7c4fdbcf92.zip gcc-6571e8f863736b7705f59c9ab0f17b7c4fdbcf92.tar.gz gcc-6571e8f863736b7705f59c9ab0f17b7c4fdbcf92.tar.bz2 |
btf: check hash maps are non-null before emptying
These maps will always be non-null in btf_finalize under normal
circumstances, but be safe and verify that before trying to empty them.
gcc/
* btfout.cc (btf_finalize): Check that hash maps are non-null before
emptying them.
-rw-r--r-- | gcc/btfout.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/btfout.cc b/gcc/btfout.cc index 083ca48..4a6b545 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -1661,13 +1661,19 @@ btf_finalize (void) datasecs.release (); funcs = NULL; - func_map->empty (); - func_map = NULL; + if (func_map) + { + func_map->empty (); + func_map = NULL; + } if (debug_prune_btf) { - btf_used_types->empty (); - btf_used_types = NULL; + if (btf_used_types) + { + btf_used_types->empty (); + btf_used_types = NULL; + } fixups.release (); forwards = NULL; |