]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
swapoff: add comments for do_swapoff
authorzt20xx <dev03303@linx-info.com>
Tue, 8 Apr 2025 00:49:51 +0000 (08:49 +0800)
committerKarel Zak <kzak@redhat.com>
Wed, 9 Apr 2025 09:02:56 +0000 (11:02 +0200)
[kzak@redhat.com: - add the comment to swapoff_by() too]

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/swapoff.c

index ab7e4ca11e1607315d68795d639a0ffff817e252..70422c9e2c57a31118167108e507aa82fc22d466 100644 (file)
@@ -104,7 +104,8 @@ static int do_swapoff(const char *orig_special, int quiet, int canonic)
 
        if (!canonic) {
                char *n, *v;
-
+               /* The mntcache is always used; see the main().  There is no
+                * need to free the memory allocated by mnt_resolve_spec(). */
                special = mnt_resolve_spec(orig_special, mntcache);
                if (!special && blkid_parse_tag_string(orig_special, &n, &v) == 0) {
                        special = buf = resolve_swapfile_tag(n, v);
@@ -147,6 +148,8 @@ static int swapoff_by(const char *name, const char *value, int quiet)
        char *buf = NULL;
        int rc;
 
+       /* The mntcache is always used; see the main().  There is no
+        * need to free the memory allocated by mnt_resolve_tag(). */
        special = mnt_resolve_tag(name, value, mntcache);
        if (!special)
                special = buf = resolve_swapfile_tag(name, value);