[PATCH] gas: Fix memory leaks in gen-sframe.c

Indu Bhagat indu.bhagat@oracle.com
Thu Apr 11 07:21:07 GMT 2024


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.

>       }
>   }
>   



More information about the Binutils mailing list