commands: don't deref after NULL check

Fixes: Coverity 1465657 Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent bf0b9c1e
...@@ -487,9 +487,12 @@ static int lxc_cmd_get_devpts_fd_callback(int fd, struct lxc_cmd_req *req, ...@@ -487,9 +487,12 @@ static int lxc_cmd_get_devpts_fd_callback(int fd, struct lxc_cmd_req *req,
}; };
int ret; int ret;
if (!handler->conf || handler->conf->devpts_fd < 0) if (!handler->conf || handler->conf->devpts_fd < 0) {
rsp.ret = -EBADF; rsp.ret = -EBADF;
ret = lxc_abstract_unix_send_fds(fd, &handler->conf->devpts_fd, 1, &rsp, sizeof(rsp)); ret = lxc_abstract_unix_send_fds(fd, NULL, 0, &rsp, sizeof(rsp));
} else {
ret = lxc_abstract_unix_send_fds(fd, &handler->conf->devpts_fd, 1, &rsp, sizeof(rsp));
}
if (ret < 0) if (ret < 0)
return log_error(LXC_CMD_REAP_CLIENT_FD, "Failed to send devpts fd"); return log_error(LXC_CMD_REAP_CLIENT_FD, "Failed to send devpts fd");
......
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