[lxc-devel] [PATCH] concurrent: check realloc() rc and exit on failure Signed-off-by: Arjun Sreedharan <arjun024 at gmail.com>

Serge Hallyn serge.hallyn at ubuntu.com
Thu Apr 2 20:34:03 UTC 2015


Quoting Arjun Sreedharan (arjun024 at gmail.com):

> ---

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

>  src/tests/concurrent.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/tests/concurrent.c b/src/tests/concurrent.c
> index acabbed..f32411a 100644
> --- a/src/tests/concurrent.c
> +++ b/src/tests/concurrent.c
> @@ -182,6 +182,10 @@ int main(int argc, char *argv[]) {
>                   (tok = strtok_r(mode_tok, ",", &saveptr));
>                  i++, mode_tok = NULL) {
>                  modes = realloc(modes, sizeof(*modes) * (i+2));
> +                if (!modes) {
> +                    perror("realloc");
> +                    exit(EXIT_FAILURE);
> +                }
>                  modes[i] = tok;
>  	    }
>              modes[i] = NULL;
> -- 
> 1.7.11.7
> 
> _______________________________________________
> 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