From 6688b72d32f450d243a47ab960dc131ebe666e67 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 15 May 2022 05:40:34 +0900 Subject: core/mount: use set_put_strdup_full() --- src/core/mount.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/core/mount.c') diff --git a/src/core/mount.c b/src/core/mount.c index d22e7dec59..8aaa9e966b 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -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; -- cgit v1.2.1