]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd/sd-login/sd-login.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / libsystemd / sd-login / sd-login.c
index b75acef82c09675f7d9dfb221ba6bed8f1813fdf..e8adaa6823238f87baaf682010012ed05345ead9 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -293,7 +294,7 @@ _public_ int sd_uid_get_state(uid_t uid, char**state) {
                         return -ENOMEM;
 
         }
-        if (r < 0) {
+        else if (r < 0) {
                 free(s);
                 return r;
         }
@@ -878,7 +879,8 @@ _public_ int sd_get_uids(uid_t **users) {
 }
 
 _public_ int sd_get_machine_names(char ***machines) {
-        char **l, **a, **b;
+        _cleanup_strv_free_ char **l = NULL;
+        char **a, **b;
         int r;
 
         r = get_files_in_directory("/run/systemd/machines/", &l);
@@ -907,8 +909,10 @@ _public_ int sd_get_machine_names(char ***machines) {
                 *b = NULL;
         }
 
-        if (machines)
+        if (machines) {
                 *machines = l;
+                l = NULL;
+        }
         return r;
 }