From: Lennart Poettering Date: Wed, 10 Jun 2020 14:53:24 +0000 (+0200) Subject: sleep-config: modernize destructors X-Git-Tag: v246-rc1~163^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1326de01588a765e96ed5b187566d10655aacc01;p=thirdparty%2Fsystemd.git sleep-config: modernize destructors All other destructors in the same .c file return NULL, let's make sure the one where this so far wasn't done does it too. --- diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 3a354e172e6..6b9074ce2b2 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -677,9 +677,9 @@ int sleep_settings(const char *verb, const SleepConfig *sleep_config, bool *ret_ return 0; } -void free_sleep_config(SleepConfig *sc) { +SleepConfig* free_sleep_config(SleepConfig *sc) { if (!sc) - return; + return NULL; strv_free(sc->suspend_modes); strv_free(sc->suspend_states); @@ -690,5 +690,5 @@ void free_sleep_config(SleepConfig *sc) { strv_free(sc->hybrid_modes); strv_free(sc->hybrid_states); - free(sc); + return mfree(sc); } diff --git a/src/shared/sleep-config.h b/src/shared/sleep-config.h index faa3c0519aa..86dfbf19be0 100644 --- a/src/shared/sleep-config.h +++ b/src/shared/sleep-config.h @@ -20,7 +20,7 @@ typedef struct SleepConfig { usec_t hibernate_delay_sec; /* HibernateDelaySec */ } SleepConfig; -void free_sleep_config(SleepConfig *sc); +SleepConfig* free_sleep_config(SleepConfig *sc); DEFINE_TRIVIAL_CLEANUP_FUNC(SleepConfig*, free_sleep_config); /* entry in /proc/swaps */