]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: fix a small mem leak when CLI args have errors
authorPádraig Brady <P@draigBrady.com>
Wed, 22 Jul 2026 19:36:42 +0000 (20:36 +0100)
committerPádraig Brady <P@draigBrady.com>
Fri, 24 Jul 2026 12:35:30 +0000 (13:35 +0100)
commit1f681f8a7212e4f40addf54fb355aac906b85bee
treef1ef8ea44a77ece3c6d26d8bff48904e306ed59a
parent8f7ed6cf504ca492ba1a85f10dae86bf19030707
ls: fix a small mem leak when CLI args have errors

  $ valgrind --quiet --leak-check=full --show-leak-kinds=definite \
    src/ls --hyperlink=always foo bar
  ls: cannot access 'foo': No such file or directory
  ls: cannot access 'bar': No such file or directory

    32 bytes in 1 blocks are definitely lost in loss record 3 of 7
    at malloc (vg_replace_malloc.c:447)
    by canonicalize_filename_mode_stk (canonicalize.c:450)
    by canonicalize_filename_mode (canonicalize.c:471)
    by gobble_file.constprop.0 (ls.c:3392)
    by main (ls.c:1765)

* src/ls.c (gobble_file): Call free_ent() before returning.
src/ls.c