Subject: bug#79023: 30.1.90; Suspicion of memory leak on internal_redisplay (MacOS)

From: Alan Third <[email-masked]>
Date: Wed, 16 Jul 2025 15:45:21 +0100

On Wed, Jul 16, 2025 at 02:54:06PM +0200, Przemysław Alexander Kamiński wrote:
> 
> diff --git a/src/nsfont.m b/src/nsfont.m
> index b8aa6764..f99980b1 100644
> --- a/src/nsfont.m
> +++ b/src/nsfont.m
> @@ -529,6 +529,10 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
>        chars[95] = '\0';
>  
>        ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars];
> +      if (ascii_printable != nil )
> +      {
> +        [ascii_printable autorelease];
> +      }
>      }
>  
>    if (w < (CGFloat) 0.0)

Is this the full patch? Unfortunately nsfont.m isn't used on macos,
it's only for GNUstep.

Also I'm pretty sure that when using alloc the object's lifetime is
restricted to the calling function, you need to retain the object if
you want to keep it.

I'm not saying we definitely don't make a mistake somewhere with
retain/release, but this probably isn't it.
-- 
Alan Third