mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
basic/unit-file: fix use-after-free
This fixes a bug introduced by e8630e6952.
Fixes CID#1453292.
This commit is contained in:
@@ -303,11 +303,11 @@ int unit_file_build_name_map(
|
||||
return log_oom();
|
||||
|
||||
if (paths) {
|
||||
r = set_consume(paths, filename);
|
||||
r = set_put(paths, filename);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
/* We will still use filename below. This is safe because we know the set
|
||||
* holds a reference. */
|
||||
if (r == 0)
|
||||
_filename_free = filename; /* Make sure we free the filename. */
|
||||
} else
|
||||
_filename_free = filename; /* Make sure we free the filename. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user