]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/mount: use set_put_strdup_full()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 14 May 2022 20:40:34 +0000 (05:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Aug 2022 16:32:28 +0000 (01:32 +0900)
src/core/mount.c

index d22e7dec5939d68e93a402438fcddc095227a02f..8aaa9e966b9d9d7e9089b4c756d9be1d00abd6ab 100644 (file)
@@ -1984,7 +1984,7 @@ static int drain_libmount(Manager *m) {
 }
 
 static int mount_process_proc_self_mountinfo(Manager *m) {
-        _cleanup_set_free_free_ Set *around = NULL, *gone = NULL;
+        _cleanup_set_free_ Set *around = NULL, *gone = NULL;
         const char *what;
         int r;
 
@@ -2015,13 +2015,10 @@ static int mount_process_proc_self_mountinfo(Manager *m) {
                          * existed. */
 
                         if (mount->from_proc_self_mountinfo &&
-                            mount->parameters_proc_self_mountinfo.what) {
-
+                            mount->parameters_proc_self_mountinfo.what)
                                 /* Remember that this device might just have disappeared */
-                                if (set_ensure_allocated(&gone, &path_hash_ops) < 0 ||
-                                    set_put_strdup(&gone, mount->parameters_proc_self_mountinfo.what) < 0)
+                                if (set_put_strdup_full(&gone, &path_hash_ops_free, mount->parameters_proc_self_mountinfo.what) < 0)
                                         log_oom(); /* we don't care too much about OOM here... */
-                        }
 
                         mount->from_proc_self_mountinfo = false;
                         assert_se(update_parameters_proc_self_mountinfo(mount, NULL, NULL, NULL) >= 0);
@@ -2079,13 +2076,10 @@ static int mount_process_proc_self_mountinfo(Manager *m) {
 
                 if (mount_is_mounted(mount) &&
                     mount->from_proc_self_mountinfo &&
-                    mount->parameters_proc_self_mountinfo.what) {
+                    mount->parameters_proc_self_mountinfo.what)
                         /* Track devices currently used */
-
-                        if (set_ensure_allocated(&around, &path_hash_ops) < 0 ||
-                            set_put_strdup(&around, mount->parameters_proc_self_mountinfo.what) < 0)
+                        if (set_put_strdup_full(&around, &path_hash_ops_free, mount->parameters_proc_self_mountinfo.what) < 0)
                                 log_oom();
-                }
 
                 /* Reset the flags for later calls */
                 mount->proc_flags = 0;