[4/6,gdb/symtab] Replace TYPE_ALLOC + memset with TYPE_ZALLOC

Message ID 20230830191336.15885-4-tdevries@suse.de
State Committed
Headers
Series [1/6,gdb/symtab] Fix uninitialized memory in buildsym_compunit::finish_block_internal |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Patch failed to apply

Commit Message

Tom de Vries Aug. 30, 2023, 7:13 p.m. UTC
  I noticed a case or TYPE_ALLOC followed by memset.

Replace this with TYPE_ZALLOC.

Tested on x86_64-linux.
---
 gdb/stabsread.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Tom Tromey Aug. 30, 2023, 8:20 p.m. UTC | #1
>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> I noticed a case or TYPE_ALLOC followed by memset.
Tom> Replace this with TYPE_ZALLOC.

Tom> Tested on x86_64-linux.

Obvious IMO.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index ad9258a9f20..18fefd6929c 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2693,9 +2693,7 @@  read_member_functions (struct stab_field_info *fip, const char **pp,
     {
       ALLOCATE_CPLUS_STRUCT_TYPE (type);
       TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
-	TYPE_ALLOC (type, sizeof (struct fn_fieldlist) * nfn_fields);
-      memset (TYPE_FN_FIELDLISTS (type), 0,
-	      sizeof (struct fn_fieldlist) * nfn_fields);
+	TYPE_ZALLOC (type, sizeof (struct fn_fieldlist) * nfn_fields);
       TYPE_NFN_FIELDS (type) = nfn_fields;
     }