[binutils-gdb] Ensure that sframe_xlate_ctx_cleanup() doe snot leave any dangling pointers

Nick Clifton via Binutils-cvs <[email protected]> Fri, 31 Jul 2026 08:07:05 +0000 (GMT)
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dfa11363bc9ad=
30671372670ec5216c723ab4db42

commit fa11363bc9ad30671372670ec5216c723ab4db42
Author: Nick Clifton <[email protected]>
Date:   Fri Jul 31 09:06:09 2026 +0100

    Ensure that sframe_xlate_ctx_cleanup() doe snot leave any dangling poin=
ters

Diff:
---
 gas/gen-sframe.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index b5c8f649bea..7b8c2f2f20e 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -426,7 +426,7 @@ get_fre_dataword_count (const struct sframe_row_entry *=
sframe_fre, bool flex_p)
=20
 static unsigned int
 sframe_get_fre_dataword_size (const struct sframe_row_entry *sframe_fre,
-			    bool flex_p)
+			      bool flex_p)
 {
   unsigned int max_dataword_size =3D 0;
   unsigned int cfa_offset_size =3D 0;
@@ -1094,6 +1094,10 @@ static void
 sframe_xlate_ctx_cleanup (struct sframe_xlate_ctx *xlate_ctx)
 {
   sframe_row_entry_free (xlate_ctx->first_fre);
+  xlate_ctx->first_fre =3D NULL;
+  xlate_ctx->last_fre =3D NULL;
+  xlate_ctx->num_xlate_fres =3D 0;
+  xlate_ctx->flex_p =3D false;
   XDELETE (xlate_ctx->remember_fre);
   xlate_ctx->remember_fre =3D NULL;
   XDELETE (xlate_ctx->cur_fre);