[lxc-devel] [PATCH 2/6] coverity: Silence potential null-deref warning
Serge Hallyn
serge.hallyn at ubuntu.com
Sat Feb 15 00:00:12 UTC 2014
Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
Technically a BUG_ON(!array) might be called for instead, but
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/lxc_attach.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/lxc/lxc_attach.c b/src/lxc/lxc_attach.c
> index e3e89c4..33d5e91 100644
> --- a/src/lxc/lxc_attach.c
> +++ b/src/lxc/lxc_attach.c
> @@ -78,7 +78,8 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value)
> *capacity = new_capacity;
> }
>
> - (*array)[count] = value;
> + if (array)
> + (*array)[count] = value;
> return 0;
> }
>
> --
> 1.9.rc1
>
> _______________________________________________
> 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