1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

login: use free_and_strdup() at one more place

This commit is contained in:
Yu Watanabe 2019-01-08 02:41:15 +09:00
parent 543680f415
commit 6b9f8b7135

View File

@ -1502,7 +1502,6 @@ static int execute_shutdown_or_sleep(
sd_bus_error *error) { sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
char *c = NULL;
const char *p; const char *p;
int r; int r;
@ -1530,15 +1529,11 @@ static int execute_shutdown_or_sleep(
if (r < 0) if (r < 0)
goto error; goto error;
c = strdup(p); r = free_and_strdup(&m->action_job, p);
if (!c) { if (r < 0)
r = -ENOMEM;
goto error; goto error;
}
m->action_unit = unit_name; m->action_unit = unit_name;
free(m->action_job);
m->action_job = c;
m->action_what = w; m->action_what = w;
/* Make sure the lid switch is ignored for a while */ /* Make sure the lid switch is ignored for a while */