X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fsleep-config.c;h=867e4edaa2e79978b963594e30feee6deff594e5;hb=037c26d0aeb750ca9c8d605884ea1db7baecfea8;hp=70a08960690060abd583c20f5650733e4b3935e4;hpb=dabeaa460d9fa01db645116775f53e3071977503;p=elogind.git diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 70a089606..867e4edaa 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -31,6 +31,7 @@ #define USE(x, y) do{ (x) = (y); (y) = NULL; } while(0) int parse_sleep_config(const char *verb, char ***_modes, char ***_states) { + _cleanup_strv_free_ char **suspend_mode = NULL, **suspend_state = NULL, **hibernate_mode = NULL, **hibernate_state = NULL, @@ -44,10 +45,11 @@ int parse_sleep_config(const char *verb, char ***_modes, char ***_states) { { "Sleep", "HibernateState", config_parse_strv, 0, &hibernate_state }, { "Sleep", "HybridSleepMode", config_parse_strv, 0, &hybrid_mode }, { "Sleep", "HybridSleepState", config_parse_strv, 0, &hybrid_state }, - {}}; + {} + }; int r; - FILE _cleanup_fclose_ *f; + _cleanup_fclose_ FILE *f; f = fopen(PKGSYSCONFDIR "/sleep.conf", "re"); if (!f) @@ -174,7 +176,7 @@ static int hibernation_partition_size(size_t *size, size_t *used) { assert(size); assert(used); - f = fopen("/proc/swaps", "r"); + f = fopen("/proc/swaps", "re"); if (!f) { log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, "Failed to retrieve open /proc/swaps: %m"); @@ -220,8 +222,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) { static bool enough_memory_for_hibernation(void) { _cleanup_free_ char *active = NULL; - unsigned long long act; - size_t size, used; + unsigned long long act = 0; + size_t size = 0, used = 0; int r; r = hibernation_partition_size(&size, &used);