summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-12-11 21:14:39 +0100
committerHarald Welte <laforge@gnumonks.org>2016-12-12 10:59:20 +0000
commit26bcc0b9c4f0240b5caad1b410a966f76563e631 (patch)
tree2c3042af1425ad84ee2d419566c9771cde2edafb
parent8fab8413bf76d47300a9d0b0f995ffe7691169b2 (diff)
fix NULL deref: sua_accept_cb: missing error-return
When server creation failed, besides closing the fd also return an error, instead of continuing to use the NULL srv. Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577 Fixes: coverity CID#57684
-rw-r--r--src/sua.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sua.c b/src/sua.c
index 799d270..442b2a0 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -1261,8 +1261,10 @@ static int sua_accept_cb(struct osmo_stream_srv_link *link, int fd)
srv = osmo_stream_srv_create(user, link, fd,
sua_srv_conn_cb,
sua_srv_conn_closed_cb, NULL);
- if (!srv)
+ if (!srv) {
close(fd);
+ return -1;
+ }
/* create new SUA link and connect both data structures */
sual = sua_link_new(user, 1);