]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: port to static destructors
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Mar 2019 09:42:32 +0000 (10:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Mar 2019 13:53:07 +0000 (14:53 +0100)
src/systemctl/systemctl.c

index caacfe06362d1cc4bffbd386b764fce6252b5272..637985bcda210f6cdbfb6e1996f43714c2d6e50c 100644 (file)
@@ -179,6 +179,12 @@ static bool arg_now = false;
 static bool arg_jobs_before = false;
 static bool arg_jobs_after = false;
 
+STATIC_DESTRUCTOR_REGISTER(arg_wall, strv_freep);
+STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
+STATIC_DESTRUCTOR_REGISTER(arg_types, strv_freep);
+STATIC_DESTRUCTOR_REGISTER(arg_states, strv_freep);
+STATIC_DESTRUCTOR_REGISTER(arg_properties, strv_freep);
+
 static int daemon_reload(int argc, char *argv[], void* userdata);
 static int trivial_method(int argc, char *argv[], void *userdata);
 static int halt_now(enum action a);
@@ -9245,13 +9251,6 @@ static int run(int argc, char *argv[]) {
 finish:
         release_busses();
 
-        strv_free(arg_types);
-        strv_free(arg_states);
-        strv_free(arg_properties);
-
-        strv_free(arg_wall);
-        free(arg_root);
-
         /* Note that we return r here, not 0, so that we can implement the LSB-like return codes */
         return r;
 }