From: Yu Watanabe Date: Mon, 7 Jan 2019 17:41:15 +0000 (+0900) Subject: login: use free_and_strdup() at one more place X-Git-Tag: v241-rc1~94^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b9f8b71351cf715f2bfe491f0769a3f4df0a7ce;p=thirdparty%2Fsystemd.git login: use free_and_strdup() at one more place --- diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 2392435f218..bb3f6b84519 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -1502,7 +1502,6 @@ static int execute_shutdown_or_sleep( sd_bus_error *error) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; - char *c = NULL; const char *p; int r; @@ -1530,15 +1529,11 @@ static int execute_shutdown_or_sleep( if (r < 0) goto error; - c = strdup(p); - if (!c) { - r = -ENOMEM; + r = free_and_strdup(&m->action_job, p); + if (r < 0) goto error; - } m->action_unit = unit_name; - free(m->action_job); - m->action_job = c; m->action_what = w; /* Make sure the lid switch is ignored for a while */