[lxc-devel] [PATCH 1/3] coverity: fix dereference before NULL check

Serge Hallyn serge.hallyn at ubuntu.com
Fri May 3 21:38:30 UTC 2013


Quoting Dwight Engen (dwight.engen at oracle.com):
> also fixed some error strings while here
> 
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

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

> ---
>  src/tests/cgpath.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/tests/cgpath.c b/src/tests/cgpath.c
> index de2d13b..d8c3624 100644
> --- a/src/tests/cgpath.c
> +++ b/src/tests/cgpath.c
> @@ -51,8 +51,7 @@ int main()
>  
>  	printf("Basic cgroup path tests...\n");
>  	path = lxc_cgroup_path_create(NULL, MYNAME);
> -	len = strlen(path);
> -	if (!path || !len) {
> +	if (!path || !(len = strlen(path))) {
>  		TSTERR("zero result from lxc_cgroup_path_create");
>  		exit(1);
>  	}
> @@ -110,7 +109,7 @@ int main()
>  
>  	/* start second container */
>  	if ((c2 = lxc_container_new(MYNAME2, ALTBASE)) == NULL) {
> -		TSTERR("instantiating first container");
> +		TSTERR("instantiating second container");
>  		goto out;
>  	}
>  	if (c2->is_defined(c2)) {
> @@ -120,14 +119,14 @@ int main()
>  	}
>  	c2->set_config_item(c2, "lxc.network.type", "empty");
>  	if (!c2->createl(c2, "ubuntu", NULL)) {
> -		TSTERR("creating first container");
> +		TSTERR("creating second container");
>  		goto out;
>  	}
>  
>  	c2->load_config(c2, NULL);
>  	c2->want_daemonize(c2);
>  	if (!c2->startl(c2, 0, NULL)) {
> -		TSTERR("starting first container");
> +		TSTERR("starting second container");
>  		goto out;
>  	}
>  
> -- 
> 1.8.1.4
> 
> 
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list