]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (tab) avoid leaking memory allocated in loop
authorThomas Weißschuh <thomas@t-8ch.de>
Wed, 27 Sep 2023 18:37:22 +0000 (20:37 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 1 Oct 2023 12:08:49 +0000 (14:08 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libmount/src/tab.c

index 60bef8b2d16b394bb065e0becd6061dfd4b9f6c2..c6be5369e3de5f62ff1880a185480b78251bd52e 100644 (file)
@@ -1856,6 +1856,7 @@ int __mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_f
                                if (!*p)
                                        tgt = tgt_prefix;       /* target is '/' */
                                else {
+                                       free(tgt_buf);
                                        if (asprintf(&tgt_buf, "%s/%s", tgt_prefix, p) <= 0) {
                                                rc = -ENOMEM;
                                                goto done;