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
This commit is contained in:
Neels Hofmeyr 2016-12-11 21:14:39 +01:00 committed by Harald Welte
parent 8fab8413bf
commit 26bcc0b9c4
1 changed files with 3 additions and 1 deletions

View File

@ -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);