diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-01-23 15:50:36 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-01-23 22:06:05 +0100 |
commit | de5d8b40eda84cfd546c9d969a191ce4615e6375 (patch) | |
tree | 175c36d98acd25261a6427099b502f5fde068124 /src/sleep | |
parent | 099810a65b8d7e7e83098edff144643b77011a85 (diff) | |
download | systemd-de5d8b40eda84cfd546c9d969a191ce4615e6375.tar.gz |
sleep: fix memleak
Those hashmaps are created anew in each iteration of the loop. The
leak wasn't really a problem, because the loop is bounded and the
hashmaps were not huge, but it's nicer to be correct.
Diffstat (limited to 'src/sleep')
-rw-r--r-- | src/sleep/sleep.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c index de5b9ae192..c2c8c779ad 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c @@ -267,12 +267,12 @@ static int execute( } static int custom_timer_suspend(const SleepConfig *sleep_config) { - _cleanup_hashmap_free_ Hashmap *last_capacity = NULL, *current_capacity = NULL; int r; assert(sleep_config); while (battery_is_low() == 0) { + _cleanup_hashmap_free_ Hashmap *last_capacity = NULL, *current_capacity = NULL; _cleanup_close_ int tfd = -EBADF; struct itimerspec ts = {}; usec_t suspend_interval = sleep_config->hibernate_delay_sec, before_timestamp = 0, after_timestamp = 0, total_suspend_interval; |