]> git.ipfire.org Git - thirdparty/systemd.git/commit
homectl: fix memory leak
authorDavid Tardon <dtardon@redhat.com>
Thu, 6 Nov 2025 12:54:35 +0000 (13:54 +0100)
committerDavid Tardon <dtardon@redhat.com>
Thu, 6 Nov 2025 13:21:43 +0000 (14:21 +0100)
commit5efcbae259826a184dc962822a4e060a21f5175c
treef29709e6c64c75d0bb1be3d71b455f30519cf891
parent6f8e6e50a0e3901e347840c323b1b450945d047a
homectl: fix memory leak

 # valgrind --leak-check=full homectl create waldo --real-name=Waldo --disk-size=200M --setopt=FOO=bar

Before:

==25155== HEAP SUMMARY:
==25155==     in use at exit: 12,879 bytes in 39 blocks
==25155==   total heap usage: 90 allocs, 51 frees, 53,964 bytes allocated
==25155==
==25155== 8 bytes in 1 blocks are definitely lost in loss record 4 of 38
==25155==    at 0x4845866: malloc (vg_replace_malloc.c:446)
==25155==    by 0x547FC2E: strdup (strdup.c:42)
==25155==    by 0x4B2647C: strv_env_replace_strdup_passthrough (env-util.c:435)
==25155==    by 0x42D547: parse_argv (homectl.c:3909)
==25155==    by 0x43999C: run (homectl.c:5606)
==25155==    by 0x4399F5: main (homectl.c:5613)
==25155==
==25155== LEAK SUMMARY:
==25155==    definitely lost: 8 bytes in 1 blocks

After:

==25224== HEAP SUMMARY:
==25224==     in use at exit: 12,871 bytes in 38 blocks
==25224==   total heap usage: 90 allocs, 52 frees, 53,964 bytes allocated
==25224==
==25224== LEAK SUMMARY:
==25224==    definitely lost: 0 bytes in 0 blocks

Follow-up-for: aaf057c4bbc6055040d7d2c1ec3655ff89249ebd
src/home/homectl.c