mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-20 14:03:39 +03:00
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. (cherry picked from commit de5d8b40eda84cfd546c9d969a191ce4615e6375)
This commit is contained in:
parent
224f912cba
commit
34157bba08
@ -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 = -1;
|
||||
struct itimerspec ts = {};
|
||||
usec_t suspend_interval = sleep_config->hibernate_delay_sec, before_timestamp = 0, after_timestamp = 0, total_suspend_interval;
|
||||
|
Loading…
x
Reference in New Issue
Block a user