]> 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>
Mon, 10 Dec 2018 08:22:17 +0000 (09:22 +0100)
Dereference after null check

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

index 7991bb0e1b5095d4ea8de7f5e6699e84341f5885..b5c22e1648dc121736afa7e8f640dc8859507982 100644 (file)
@@ -741,11 +741,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);