From: Serge Hallyn Date: Sun, 18 Oct 2015 02:16:12 +0000 (-0500) Subject: coverity: free mounts on error path X-Git-Tag: lxc-2.0.0.beta1~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e963273a779104424d69783117317e588e6f054b;p=thirdparty%2Flxc.git coverity: free mounts on error path Signed-off-by: Serge Hallyn --- diff --git a/hooks/unmount-namespace.c b/hooks/unmount-namespace.c index 9b4033fbd..99b284481 100644 --- a/hooks/unmount-namespace.c +++ b/hooks/unmount-namespace.c @@ -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))) {