findmnt: fix couple memory leaks [cppcheck]

In both cases FILE *f was leaked.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
pull/416/head
Sami Kerola 6 years ago committed by Karel Zak
parent c5e3ebcedc
commit 79b915e8df
  1. 10
      misc-utils/findmnt-verify.c

@ -328,14 +328,15 @@ static int read_proc_filesystems(struct verify_context *vfy)
rc = add_filesystem(vfy, cp);
if (rc)
return rc;
break;
}
fclose(f);
return 0;
return rc;
}
static int read_kernel_filesystems(struct verify_context *vfy)
{
int rc = 0;
#ifdef __linux__
struct utsname uts;
FILE *f;
@ -351,7 +352,6 @@ static int read_kernel_filesystems(struct verify_context *vfy)
while (!feof(f)) {
char *p, *name;
int rc;
if (!fgets(buf, sizeof(buf), f))
break;
@ -377,11 +377,11 @@ static int read_kernel_filesystems(struct verify_context *vfy)
rc = add_filesystem(vfy, name);
if (rc)
return rc;
break;
}
fclose(f);
#endif /* __linux__ */
return 0;
return rc;
}
static int verify_fstype(struct verify_context *vfy)

Loading…
Cancel
Save