summaryrefslogtreecommitdiff
path: root/src/tty-ask-password-agent/tty-ask-password-agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty-ask-password-agent/tty-ask-password-agent.c')
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index a7fce518a5..2c540ba170 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -102,8 +102,9 @@ static int ask_password_plymouth(
if (accept_cached) {
packet = strdup("c");
n = 1;
- } else
- asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1), message, &n);
+ } else if (asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1),
+ message, &n) < 0)
+ packet = NULL;
if (!packet) {
r = -ENOMEM;