public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gas: Fix memory leaks in gen-sframe.c
@ 2024-04-09 23:05 H.J. Lu
  2024-04-11  7:21 ` Indu Bhagat
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2024-04-09 23:05 UTC (permalink / raw)
  To: binutils; +Cc: indu.bhagat

	* gen-sframe.c (sframe_xlate_ctx_cleanup): Call XDELETE on
	xlate_ctx->cur_fre.
	(create_sframe_all): Call XDELETE on xlate_ctx after use.
---
 gas/gen-sframe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index 75781fc8ccb..991bf10cbc4 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -847,6 +847,8 @@ sframe_xlate_ctx_cleanup (struct sframe_xlate_ctx *xlate_ctx)
 	}
     }
 
+  XDELETE (xlate_ctx->cur_fre);
+
   sframe_xlate_ctx_init (xlate_ctx);
 }
 
@@ -1359,6 +1361,7 @@ create_sframe_all (void)
 	  sframe_xlate_ctx_finalize (xlate_ctx, sframe_fde);
 	  sframe_fde_link (sframe_fde);
 	}
+      XDELETE (xlate_ctx);
     }
 }
 
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gas: Fix memory leaks in gen-sframe.c
  2024-04-09 23:05 [PATCH] gas: Fix memory leaks in gen-sframe.c H.J. Lu
@ 2024-04-11  7:21 ` Indu Bhagat
  2024-04-11 11:28   ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Indu Bhagat @ 2024-04-11  7:21 UTC (permalink / raw)
  To: H.J. Lu, binutils

On 4/9/24 16:05, H.J. Lu wrote:
> 	* gen-sframe.c (sframe_xlate_ctx_cleanup): Call XDELETE on
> 	xlate_ctx->cur_fre.
> 	(create_sframe_all): Call XDELETE on xlate_ctx after use.
> ---
>   gas/gen-sframe.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> index 75781fc8ccb..991bf10cbc4 100644
> --- a/gas/gen-sframe.c
> +++ b/gas/gen-sframe.c
> @@ -847,6 +847,8 @@ sframe_xlate_ctx_cleanup (struct sframe_xlate_ctx *xlate_ctx)
>   	}
>       }
>   
> +  XDELETE (xlate_ctx->cur_fre);
> +
>     sframe_xlate_ctx_init (xlate_ctx);
>   }
>   
> @@ -1359,6 +1361,7 @@ create_sframe_all (void)
>   	  sframe_xlate_ctx_finalize (xlate_ctx, sframe_fde);
>   	  sframe_fde_link (sframe_fde);
>   	}
> +      XDELETE (xlate_ctx);

This is wrongly placed.  It should be outside the for_each_FDE loop, 
currently it is inside.

>       }
>   }
>   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gas: Fix memory leaks in gen-sframe.c
  2024-04-11  7:21 ` Indu Bhagat
@ 2024-04-11 11:28   ` H.J. Lu
  0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2024-04-11 11:28 UTC (permalink / raw)
  To: Indu Bhagat; +Cc: binutils

On Thu, Apr 11, 2024 at 12:21 AM Indu Bhagat <indu.bhagat@oracle.com> wrote:
>
> On 4/9/24 16:05, H.J. Lu wrote:
> >       * gen-sframe.c (sframe_xlate_ctx_cleanup): Call XDELETE on
> >       xlate_ctx->cur_fre.
> >       (create_sframe_all): Call XDELETE on xlate_ctx after use.
> > ---
> >   gas/gen-sframe.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> > index 75781fc8ccb..991bf10cbc4 100644
> > --- a/gas/gen-sframe.c
> > +++ b/gas/gen-sframe.c
> > @@ -847,6 +847,8 @@ sframe_xlate_ctx_cleanup (struct sframe_xlate_ctx *xlate_ctx)
> >       }
> >       }
> >
> > +  XDELETE (xlate_ctx->cur_fre);
> > +
> >     sframe_xlate_ctx_init (xlate_ctx);
> >   }
> >
> > @@ -1359,6 +1361,7 @@ create_sframe_all (void)
> >         sframe_xlate_ctx_finalize (xlate_ctx, sframe_fde);
> >         sframe_fde_link (sframe_fde);
> >       }
> > +      XDELETE (xlate_ctx);
>
> This is wrongly placed.  It should be outside the for_each_FDE loop,
> currently it is inside.

Fixed by the v2 patch:

https://sourceware.org/pipermail/binutils/2024-April/133562.html


-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-11 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 23:05 [PATCH] gas: Fix memory leaks in gen-sframe.c H.J. Lu
2024-04-11  7:21 ` Indu Bhagat
2024-04-11 11:28   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).