aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-26 00:11:53 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-26 10:24:19 +0100
commit4a1cb09a40aaba7f412d1384b2a1a06934310359 (patch)
treef327993804d2cc4fc127aa14486d0ccbd42e14a9 /src
parent0fc315dd9ed35ab9d32b60cbcd225f413b6a601e (diff)
telnet_interface: Handle osmo_fd_register() eror return code
Change-Id: I5bc1c2cbb04e363d868355b5ed866b4840f16c61 Fixes: Coverity 57637
Diffstat (limited to 'src')
-rw-r--r--src/vty/telnet_interface.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vty/telnet_interface.c b/src/vty/telnet_interface.c
index e86a6b13..218f9abf 100644
--- a/src/vty/telnet_interface.c
+++ b/src/vty/telnet_interface.c
@@ -145,6 +145,7 @@ static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
struct sockaddr_in sockaddr;
socklen_t len = sizeof(sockaddr);
int new_connection = accept(fd->fd, (struct sockaddr*)&sockaddr, &len);
+ int rc;
if (new_connection < 0) {
LOGP(0, LOGL_ERROR, "telnet accept failed\n");
@@ -157,7 +158,11 @@ static int telnet_new_connection(struct osmo_fd *fd, unsigned int what)
connection->fd.fd = new_connection;
connection->fd.when = BSC_FD_READ;
connection->fd.cb = client_data;
- osmo_fd_register(&connection->fd);
+ rc = osmo_fd_register(&connection->fd);
+ if (rc < 0) {
+ talloc_free(connection);
+ return rc;
+ }
llist_add_tail(&connection->entry, &active_connections);
connection->vty = vty_create(new_connection, connection);