]> git.ipfire.org Git - thirdparty/systemd.git/commit
fstab-generator: Prevent double free of reused FILE*
authorWieland Hoffmann <themineo@gmail.com>
Thu, 2 May 2019 18:10:08 +0000 (20:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 3 May 2019 11:22:36 +0000 (13:22 +0200)
commit8a7033ac2f3ac6d30ae7f453074a1ed47243fbf2
tree572e02b6d75687c11c3b4bebfcbf40a994c91bb2
parent64538af89b4fe72658d7b33e2022d06805badb14
fstab-generator: Prevent double free of reused FILE*

When the .automount unit file already existed for any reason in the
`normal-dir` passed to `systemd-fstab-generator`, but the normal .mount unit
file did not, `f` was closed (but _not_ set to NULL). The call to
`generator_open_unit_file(..., automount_name, &f)` then failed because the
.mount unit file already existed. Now `f` did not point to an open FILE and the
later cleanup from the `_cleanup_fclose_` attribute failed with a double free.
Reset `f` to NULL before reusing it.
src/fstab-generator/fstab-generator.c