sleep-config: modernize destructors
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Jun 2020 14:53:24 +0000 (16:53 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 11 Jun 2020 08:33:57 +0000 (10:33 +0200)
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.

src/shared/sleep-config.c
src/shared/sleep-config.h

index 3a354e172e6203543aebafb9284db6bc353e5928..6b9074ce2b23afc03b04bc943deb4069723b5938 100644 (file)
@@ -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);
 }
index faa3c0519aac9cf3bd27af94c23b76b65d79e63b..86dfbf19be00802ae515684c86e09604aef73f95 100644 (file)
@@ -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 */