]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ask-password: fix minor memory leak on error path
authorLennart Poettering <lennart@poettering.net>
Tue, 6 Nov 2018 11:34:01 +0000 (12:34 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 6 Nov 2018 13:41:01 +0000 (16:41 +0300)
CID 1396557

src/shared/ask-password-api.c

index df5ede77b95b1e9391934ee4250cae2e63f1b7ce..0240f785c78bd9d56f39d81a028f9fbff4ec92e2 100644 (file)
@@ -460,11 +460,9 @@ int ask_password_tty(
                 goto finish;
         }
 
-        l = strv_new(x, NULL);
-        if (!l) {
-                r = -ENOMEM;
+        r = strv_consume(&l, x);
+        if (r < 0)
                 goto finish;
-        }
 
         if (keyname)
                 (void) add_to_keyring_and_log(keyname, flags, l);