logind: add missing OOM check in client tool
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Jul 2019 08:12:25 +0000 (10:12 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jul 2019 14:08:06 +0000 (16:08 +0200)
src/login/inhibit.c

index d96c819..25ff4d0 100644 (file)
@@ -284,7 +284,6 @@ static int run(int argc, char *argv[]) {
 
         if (arg_action == ACTION_LIST)
                 return print_inhibitors(bus);
-
         else {
                 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
                 _cleanup_strv_free_ char **arguments = NULL;
@@ -295,8 +294,13 @@ static int run(int argc, char *argv[]) {
                 /* Ignore SIGINT and allow the forked process to receive it */
                 (void) ignore_signals(SIGINT, -1);
 
-                if (!arg_who)
-                        arg_who = w = strv_join(argv + optind, " ");
+                if (!arg_who) {
+                        w = strv_join(argv + optind, " ");
+                        if (!w)
+                                return log_oom();
+
+                        arg_who = w;
+                }
 
                 if (!arg_mode)
                         arg_mode = "block";