]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1425928
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 7 Dec 2017 14:01:51 +0000 (15:01 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 7 Dec 2017 14:01:51 +0000 (15:01 +0100)
Avoid NULL-pointer dereference. Apparently monitor.{c,h} calls
lxc_check_inherited() with NULL passed for the config. This isn't really a big
issue since monitor.{c,h} is effectively dead for all liblxc versions that have
the state client patch. Also, the patch that introduces the relevant lines into
lxc_check_inherited() is only in master and yet unreleased.

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

index 72e3f0146e6c7eac90cbd2b32fbd2f6df73c6a51..b82768687a2a0250eb7bb015601c781f996f35b7 100644 (file)
@@ -226,14 +226,16 @@ restart:
                        continue;
 
                /* Keep state clients that wait on reboots. */
-               lxc_list_for_each(cur, &conf->state_clients) {
-                       struct lxc_state_client *client = cur->elem;
+               if (conf) {
+                       lxc_list_for_each(cur, &conf->state_clients) {
+                               struct lxc_state_client *client = cur->elem;
 
-                       if (client->clientfd != fd)
-                               continue;
+                               if (client->clientfd != fd)
+                                       continue;
 
-                       matched = true;
-                       break;
+                               matched = true;
+                               break;
+                       }
                }
 
                if (matched)