Bug or not? printf allocates buffer & never frees it

Florian Weimer fweimer@redhat.com
Wed Mar 17 17:45:57 GMT 2021


* Ian Pilcher via Libc-help:

> Fedora 33 with glibc-2.32-4.fc33.x86_64.
>
> Simple reproducer:
>
>  #include <mcheck.h>
>  #include <stdio.h>
>
>  int main(void)
>  {
> 	mtrace();
> 	printf("%d\n", 0);
> 	muntrace();
> 	return 0;
>  }
>
> Running with MALLOC_TRACE set shows:
>
>  Memory not freed:
>  -----------------
>             Address     Size     Caller
>  0x0000000000e1d690    0x400  at 0x7f19511d2934

> Is this considered a bug?

What happens if you remove the muntrace call?  I suspect you see this
leak because you are specifically telling glibc not to log the
deallocation.

Thanks,
Florian



More information about the Libc-help mailing list