tests: check for NULL in device_add_remove

Fixes: Coverity 1472768 Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 07f89a4f
...@@ -36,8 +36,8 @@ int main(int argc, char *argv[]) ...@@ -36,8 +36,8 @@ int main(int argc, char *argv[])
__do_close int fd_log = -EBADF; __do_close int fd_log = -EBADF;
int ret = 1; int ret = 1;
struct lxc_log log = {}; struct lxc_log log = {};
struct lxc_container *c = NULL;
char template[sizeof(P_tmpdir"/attach_XXXXXX")]; char template[sizeof(P_tmpdir"/attach_XXXXXX")];
struct lxc_container *c;
(void)strlcpy(template, P_tmpdir"/attach_XXXXXX", sizeof(template)); (void)strlcpy(template, P_tmpdir"/attach_XXXXXX", sizeof(template));
...@@ -107,6 +107,7 @@ out: ...@@ -107,6 +107,7 @@ out:
} }
(void)unlink(template); (void)unlink(template);
lxc_container_put(c); if (c)
lxc_container_put(c);
return ret; return ret;
} }
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