From 61ff45db9573c7e78e1fc9c3cff77166e0036d24 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 15 Mar 2019 10:42:32 +0100 Subject: [PATCH] systemctl: port to static destructors --- src/systemctl/systemctl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index caacfe06362..637985bcda2 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -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; } -- 2.47.3