From: Theodore Ts'o Date: Sat, 3 Oct 2009 16:50:06 +0000 (-0400) Subject: lib: fix file descriptor leak in is_mounted() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09a292ff1c8fa2b446f0af9b16e57457b1300276;p=util-linux lib: fix file descriptor leak in is_mounted() Remove an extraneous fopen() that leaks memory and a file descriptor. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ismounted.c b/lib/ismounted.c index 28ae3252..fbe91f9a 100644 --- a/lib/ismounted.c +++ b/lib/ismounted.c @@ -70,9 +70,6 @@ static int check_mntent_file(const char *mtab_file, const char *file, char buf[1024], *device = 0, *mnt_dir = 0, *cp; *mount_flags = 0; - if ((f = fopen(mtab_file, "r")) == NULL) - return errno; - if ((f = setmntent (mtab_file, "r")) == NULL) return errno; if (stat(file, &st_buf) == 0) {