summaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns.c
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-10-10 16:09:32 +0200
committerStefan Sperling <ssperling@sysmocom.de>2018-10-10 16:09:32 +0200
commitf653821fb30f511be6cb775403ae3a5fc9e8ccd6 (patch)
treec63524f0261202b7c306e4b0aec99d7812eb2c38 /src/gb/gprs_ns.c
parent0903fce28be85f28b1c9e803df8cec69fefa2de9 (diff)
fix error handling gprs_ns_nsip_listen()
If we cannot bind the listening socket, reset related fields in the osmo fd structure to NULL again. Otherwise our caller might eventually try to use an uninitialized osmo fd. Change-Id: Ia953b2eff54cac0bd980944291f75db14df09a34 Related: OS#3643
Diffstat (limited to 'src/gb/gprs_ns.c')
-rw-r--r--src/gb/gprs_ns.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 9b7cc056..198ead19 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1628,8 +1628,11 @@ int gprs_ns_nsip_listen(struct gprs_ns_inst *nsi)
LOGP(DNS, LOGL_NOTICE, "Listening for nsip packets on %s:%u\n", inet_ntoa(in), nsi->nsip.local_port);
}
- if (ret < 0)
+ if (ret < 0) {
+ nsi->nsip.fd.cb = NULL;
+ nsi->nsip.fd.data = NULL;
return ret;
+ }
ret = setsockopt(nsi->nsip.fd.fd, IPPROTO_IP, IP_TOS,
&nsi->nsip.dscp, sizeof(nsi->nsip.dscp));