Skip to contentSkip to conversation

libmount/context_umount: free username after check

PATCH Applied Dave Reisner 2 participants 2 messages Sep 18, 2013 – Sep 20, 2013 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libmount/context_umount: free username after check

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)
---
 libmount/src/context_umount.c | 2 ++
 1 file changed, 2 insertions(+)
libmount/src/context_umount.c +2 -0
index 2e912c0..766adfd 100644
@@ -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) {
Signature · 1 line
1.8.4
maintainer Applied
#1 lore raw
Quoted 2 lines · Dave Reisner
 libmount/src/context_umount.c | 2 ++
 1 file changed, 2 insertions(+)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com