]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1425818
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Jun 2018 09:52:04 +0000 (11:52 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Jun 2018 10:38:14 +0000 (12:38 +0200)
Dereference after null check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 9477f2ce4624a6dab07f51a99d53231446095bbd..abddd16c7a341dc64fa58789ba2236e75d0ce01f 100644 (file)
@@ -751,11 +751,9 @@ int lxc_init(const char *name, struct lxc_handler *handler)
        TRACE("Set container state to \"STARTING\"");
 
        /* Start of environment variable setup for hooks. */
-       if (name) {
-               ret = setenv("LXC_NAME", name, 1);
-               if (ret < 0)
-                       SYSERROR("Failed to set environment variable: LXC_NAME=%s", name);
-       }
+       ret = setenv("LXC_NAME", name, 1);
+       if (ret < 0)
+               SYSERROR("Failed to set environment variable: LXC_NAME=%s", name);
 
        if (conf->rcfile) {
                ret = setenv("LXC_CONFIG_FILE", conf->rcfile, 1);