Quoting Tycho Andersen (tycho.ander...@canonical.com):
> lxc_console dereferences C, so we should check that it is not null and fail if
> it is.
> 
> Reported-by: Coverity
> Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>

jikes, thank you.

Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com>

> ---
>  src/lxc/lxccontainer.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index 6a2b080..0218e57 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -463,7 +463,11 @@ static int lxcapi_console(struct lxc_container *c, int 
> ttynum, int stdinfd,
>  {
>       int ret;
>       struct lxc_conf *old = current_config;
> -     current_config = c ? c->lxc_conf : NULL;
> +
> +     if (!c)
> +             return -1;
> +
> +     current_config = c->lxc_conf;
>       ret = lxc_console(c, ttynum, stdinfd, stdoutfd, stderrfd, escape);
>       current_config = old;
>       return ret;
> -- 
> 2.1.4
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to