summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-04 18:39:02 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-04 18:39:52 +0200
commit3a708afe63beb666b9d8fe91b0d5eb7ebccb9f0c (patch)
treef7512dc570dc9de0b1e6c09b25faf450c9ea3ba5
parent84402c0c82e0ff9591c760485e0790cf658aef91 (diff)
sgsn: Fix logically dead code in regard to the osmo_fd_register
The code was written like checking the return value of the osmo_fd_register but the rc variable was not assigned for the subsequent calls. Fixes: Coverity CID 1040741
-rw-r--r--openbsc/src/gprs/sgsn_libgtp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index 7c17f9d..f2eb35d 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -587,18 +587,23 @@ int sgsn_gtp_init(struct sgsn_instance *sgi)
sgi->gtp_fd1c.data = sgi;
sgi->gtp_fd1c.when = BSC_FD_READ;
sgi->gtp_fd1c.cb = sgsn_gtp_fd_cb;
- osmo_fd_register(&sgi->gtp_fd1c);
- if (rc < 0)
+ rc = osmo_fd_register(&sgi->gtp_fd1c);
+ if (rc < 0) {
+ osmo_fd_unregister(&sgi->gtp_fd0);
return rc;
+ }
sgi->gtp_fd1u.fd = gsn->fd1u;
sgi->gtp_fd1u.priv_nr = 2;
sgi->gtp_fd1u.data = sgi;
sgi->gtp_fd1u.when = BSC_FD_READ;
sgi->gtp_fd1u.cb = sgsn_gtp_fd_cb;
- osmo_fd_register(&sgi->gtp_fd1u);
- if (rc < 0)
+ rc = osmo_fd_register(&sgi->gtp_fd1u);
+ if (rc < 0) {
+ osmo_fd_unregister(&sgi->gtp_fd0);
+ osmo_fd_unregister(&sgi->gtp_fd1c);
return rc;
+ }
/* Start GTP re-transmission timer */
sgi->gtp_timer.cb = sgsn_gtp_tmr_cb;