[lxc-devel] [PATCH] coverity: fix fd leak in error case (1011105)
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Apr 28 17:27:34 UTC 2014
Quoting Dwight Engen (dwight.engen at oracle.com):
> I inadvertently introduced this with commit 8bf1e61e.
>
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/monitor.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c
> index 4ca4000..f356adf 100644
> --- a/src/lxc/monitor.c
> +++ b/src/lxc/monitor.c
> @@ -106,8 +106,10 @@ static void lxc_monitor_fifo_send(struct lxc_msg *msg, const char *lxcpath)
> return;
> }
>
> - if (fcntl(fd, F_SETFL, O_WRONLY) < 0)
> + if (fcntl(fd, F_SETFL, O_WRONLY) < 0) {
> + close(fd);
> return;
> + }
>
> ret = write(fd, msg, sizeof(*msg));
> if (ret != sizeof(*msg)) {
> --
> 1.9.0
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list