is this pattern used often ?
I have a vasystem() in my basement that makes this more readable.

ping me if you would like to try it.


________________________________________
Von: busybox <[email protected]> im Auftrag von Harald van Dijk 
<[email protected]>
Gesendet: Donnerstag, 6. Februar 2025 02:30:20
An: [email protected]; Anton Moryakov
Betreff: Re: [PATCH] init: fix memory leak in finalize function in bootchartd.c

On 06/02/2025 00:29, Anton Moryakov wrote:
> report:
> Dynamic memory, referenced by 'return value of xasprintf(...)',
> is allocated at xfuncs_printf.c:344 by calling function 'xasprintf' at
> bootchartd.c:318 and lost at bootchartd.c:320.

This happens in finalize(), which is called just before the process
exits. There are no subsequent allocations, which means this should be
controlled by the FEATURE_CLEAN_UP option, and not freed in normal builds:

config FEATURE_CLEAN_UP
         bool "Clean up all memory before exiting (usually not needed)"
         default n
         help
         As a size optimization, busybox normally exits without explicitly
         freeing dynamically allocated memory or closing files. This saves
         space since the OS will clean up for us, but it can confuse
debuggers
         like valgrind, which report tons of memory and resource leaks.

         Don't enable this unless you have a really good reason to clean
         things up manually.

Cheers,
Harald van Dijk
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to