]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: free username after check
authorDave Reisner <dreisner@archlinux.org>
Wed, 18 Sep 2013 14:15:29 +0000 (10:15 -0400)
committerKarel Zak <kzak@redhat.com>
Fri, 20 Sep 2013 08:06:01 +0000 (10:06 +0200)
Leak reported by valgrind:

==14226== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==14226==    at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14226==    by 0x5534839: strdup (in /usr/lib/libc-2.18.so)
==14226==    by 0x4E53FE0: mnt_get_username (utils.c:560)
==14226==    by 0x4E456A5: mnt_context_prepare_umount (context_umount.c:413)
==14226==    by 0x4E464F7: mnt_context_umount (context_umount.c:851)
==14226==    by 0x403476: umount_one (umount.c:299)
==14226==    by 0x402B34: main (umount.c:629)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
libmount/src/context_umount.c

index 2e912c0dcd1ab47238e10d87686b90cfd0fab9ba..766adfde1e7b97d4743413c1647a858eddc5d55a 100644 (file)
@@ -423,6 +423,8 @@ static int evaluate_permissions(struct libmnt_context *cxt)
                if (optstr && !mnt_optstr_get_option(optstr,
                                        "user", &mtab_user, &sz) && sz)
                        ok = !strncmp(curr_user, mtab_user, sz);
+
+               free(curr_user);
        }
 
        if (ok) {