Commit e963273a by Serge Hallyn

coverity: free mounts on error path

parent 2d9ec00d
...@@ -112,14 +112,17 @@ static int read_mounts(int procfd, struct mount **mp, size_t *countp) { ...@@ -112,14 +112,17 @@ static int read_mounts(int procfd, struct mount **mp, size_t *countp) {
*countp = 0; *countp = 0;
fd = openat(procfd, "self/mounts", O_RDONLY); fd = openat(procfd, "self/mounts", O_RDONLY);
if (fd < 0) if (fd < 0) {
free(mounts);
return 0; return 0;
}
mf = fdopen(fd, "r"); mf = fdopen(fd, "r");
if (!mf) { if (!mf) {
int error = errno; int error = errno;
close(fd); close(fd);
errno = error; errno = error;
free(mounts);
return 0; return 0;
} }
while ((ent = getmntent(mf))) { while ((ent = getmntent(mf))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment