[PATCH] Fix -Wstringop-overflow warning in ecoff_link_hash_newfunc

Andreas Schwab schwab@suse.de
Thu Sep 26 11:38:56 GMT 2024


	* ecoff.c (ecoff_link_hash_newfunc): Don't call memset if ret is
	NULL.
---
 bfd/ecoff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 04501761bd6..5ee7ffaf489 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -3278,8 +3278,8 @@ ecoff_link_hash_newfunc (struct bfd_hash_entry *entry,
       ret->abfd = NULL;
       ret->written = 0;
       ret->small = 0;
+      memset ((void *) &ret->esym, 0, sizeof ret->esym);
     }
-  memset ((void *) &ret->esym, 0, sizeof ret->esym);
 
   return (struct bfd_hash_entry *) ret;
 }
-- 
2.46.2


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Binutils mailing list