mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
tty-ask-password-agent: use free_and_strdup_warn() for arg_device (#36198)
This commit is contained in:
commit
31ce98f5f5
@ -495,7 +495,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
{}
|
||||
};
|
||||
|
||||
int c;
|
||||
int r, c;
|
||||
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
@ -537,9 +537,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Empty console device path is not allowed.");
|
||||
|
||||
arg_device = strdup(optarg);
|
||||
if (!arg_device)
|
||||
return log_oom();
|
||||
r = free_and_strdup_warn(&arg_device, optarg);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -666,6 +666,7 @@ static int ask_on_consoles(char *argv[]) {
|
||||
_cleanup_set_free_ Set *pids = NULL;
|
||||
int r;
|
||||
|
||||
assert(!arg_device);
|
||||
assert(argv);
|
||||
|
||||
r = get_kernel_consoles(&consoles);
|
||||
|
Loading…
x
Reference in New Issue
Block a user