From f2835dd4a69996807f40efaed857287fdca8de93 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 9 Dec 2020 10:07:37 +0100 Subject: [PATCH] logind: use free_and_strdup() where appropriate --- src/login/logind-button.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/login/logind-button.c b/src/login/logind-button.c index 0e38b5f57c..0ee6702068 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -68,19 +68,9 @@ void button_free(Button *b) { } int button_set_seat(Button *b, const char *sn) { - char *s; - assert(b); - assert(sn); - s = strdup(sn); - if (!s) - return -ENOMEM; - - free(b->seat); - b->seat = s; - - return 0; + return free_and_strdup(&b->seat, sn); } static void button_lid_switch_handle_action(Manager *manager, bool is_edge) {