Commit a9bafa10 by Dwight Engen Committed by Serge Hallyn

coverity: fix dereference before NULL check

also fixed some error strings while here Signed-off-by: 's avatarDwight Engen <dwight.engen@oracle.com> Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 3c73b554
...@@ -51,8 +51,7 @@ int main() ...@@ -51,8 +51,7 @@ int main()
printf("Basic cgroup path tests...\n"); printf("Basic cgroup path tests...\n");
path = lxc_cgroup_path_create(NULL, MYNAME); path = lxc_cgroup_path_create(NULL, MYNAME);
len = strlen(path); if (!path || !(len = strlen(path))) {
if (!path || !len) {
TSTERR("zero result from lxc_cgroup_path_create"); TSTERR("zero result from lxc_cgroup_path_create");
exit(1); exit(1);
} }
...@@ -110,7 +109,7 @@ int main() ...@@ -110,7 +109,7 @@ int main()
/* start second container */ /* start second container */
if ((c2 = lxc_container_new(MYNAME2, ALTBASE)) == NULL) { if ((c2 = lxc_container_new(MYNAME2, ALTBASE)) == NULL) {
TSTERR("instantiating first container"); TSTERR("instantiating second container");
goto out; goto out;
} }
if (c2->is_defined(c2)) { if (c2->is_defined(c2)) {
...@@ -120,14 +119,14 @@ int main() ...@@ -120,14 +119,14 @@ int main()
} }
c2->set_config_item(c2, "lxc.network.type", "empty"); c2->set_config_item(c2, "lxc.network.type", "empty");
if (!c2->createl(c2, "ubuntu", NULL)) { if (!c2->createl(c2, "ubuntu", NULL)) {
TSTERR("creating first container"); TSTERR("creating second container");
goto out; goto out;
} }
c2->load_config(c2, NULL); c2->load_config(c2, NULL);
c2->want_daemonize(c2); c2->want_daemonize(c2);
if (!c2->startl(c2, 0, NULL)) { if (!c2->startl(c2, 0, NULL)) {
TSTERR("starting first container"); TSTERR("starting second container");
goto out; goto out;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment