logind: use free_and_strdup() where appropriate

This commit is contained in:
Lennart Poettering 2020-12-09 10:07:37 +01:00
parent c74d5fe25d
commit f2835dd4a6
1 changed files with 1 additions and 11 deletions

View File

@ -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) {