public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmount/context_umount: free username after check
@ 2013-09-18 14:15 Dave Reisner
  2013-09-20  8:17 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Reisner @ 2013-09-18 14:15 UTC (permalink / raw)
  To: util-linux; +Cc: Dave Reisner

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 2e912c0..766adfd 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -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) {
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libmount/context_umount: free username after check
  2013-09-18 14:15 [PATCH] libmount/context_umount: free username after check Dave Reisner
@ 2013-09-20  8:17 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2013-09-20  8:17 UTC (permalink / raw)
  To: Dave Reisner; +Cc: util-linux

On Wed, Sep 18, 2013 at 10:15:29AM -0400, Dave Reisner wrote:
>  libmount/src/context_umount.c | 2 ++
>  1 file changed, 2 insertions(+)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-20  8:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18 14:15 [PATCH] libmount/context_umount: free username after check Dave Reisner
2013-09-20  8:17 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox