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) {
*countp = 0;
fd = openat(procfd, "self/mounts", O_RDONLY);
if (fd < 0)
if (fd < 0) {
free(mounts);
return 0;
}
mf = fdopen(fd, "r");
if (!mf) {
int error = errno;
close(fd);
errno = error;
free(mounts);
return 0;
}
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