logind: use free_and_strdup() where appropriate
This commit is contained in:
parent
c74d5fe25d
commit
f2835dd4a6
|
@ -68,19 +68,9 @@ void button_free(Button *b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int button_set_seat(Button *b, const char *sn) {
|
int button_set_seat(Button *b, const char *sn) {
|
||||||
char *s;
|
|
||||||
|
|
||||||
assert(b);
|
assert(b);
|
||||||
assert(sn);
|
|
||||||
|
|
||||||
s = strdup(sn);
|
return free_and_strdup(&b->seat, sn);
|
||||||
if (!s)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
free(b->seat);
|
|
||||||
b->seat = s;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void button_lid_switch_handle_action(Manager *manager, bool is_edge) {
|
static void button_lid_switch_handle_action(Manager *manager, bool is_edge) {
|
||||||
|
|
Loading…
Reference in New Issue