From: Petr Uzel Date: Thu, 14 Jun 2012 14:13:01 +0000 (+0200) Subject: libmount: plug a memory leak in exec_helper() X-Git-Tag: v2.22-rc1~281 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=31821efc2976d4d2219e51c6addf8b1222f38c3f;p=thirdparty%2Futil-linux.git libmount: plug a memory leak in exec_helper() valgrind --leak-check=full ./sys-utils/mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux .... ==21359== 28 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==21359== at 0x4C298B2: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==21359== by 0x415780: __mnt_optstr_append_option (optstr.c:188) ==21359== by 0x415CB5: mnt_optstr_set_option (optstr.c:387) ==21359== by 0x40D778: do_mount (context_mount.c:192) ==21359== by 0x40E6A9: mnt_context_do_mount (context_mount.c:685) ==21359== by 0x40EB7B: mnt_context_mount (context_mount.c:786) ==21359== by 0x4058B0: main (mount.c:918) Signed-off-by: Petr Uzel --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 69b5bfc13d..e00fbe9d0f 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -458,6 +458,7 @@ static int exec_helper(struct libmnt_context *cxt) break; } + free(o); return rc; }