aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-26 00:10:07 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-26 00:10:07 +0100
commit9d862c89989e5841a2242ed0cde0e6fa0f4a6d2e (patch)
tree42cb692c6e1f64e665fe3ce916472bf3f8a5df5a /src
parent96831049d926a6faf291a8ce29433e7718369b58 (diff)
Fix unchecked return valueof osmo_fd_register()
Change-Id: Ib040a7f94eb1bbec8270b66fd4c2aedef9d5346a Fixes: Coverity CID 57636
Diffstat (limited to 'src')
-rw-r--r--src/gsmtap_util.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c
index 7a63771a..66abdf17 100644
--- a/src/gsmtap_util.c
+++ b/src/gsmtap_util.c
@@ -333,7 +333,7 @@ static int gsmtap_sink_fd_cb(struct osmo_fd *fd, unsigned int flags)
*/
int gsmtap_source_add_sink(struct gsmtap_inst *gti)
{
- int fd;
+ int fd, rc;
fd = gsmtap_source_add_sink_fd(gsmtap_inst_fd(gti));
if (fd < 0)
@@ -347,7 +347,11 @@ int gsmtap_source_add_sink(struct gsmtap_inst *gti)
sink_ofd->when = BSC_FD_READ;
sink_ofd->cb = gsmtap_sink_fd_cb;
- osmo_fd_register(sink_ofd);
+ rc = osmo_fd_register(sink_ofd);
+ if (rc < 0) {
+ close(fd);
+ return rc;
+ }
}
return fd;
@@ -368,7 +372,7 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port,
int ofd_wq_mode)
{
struct gsmtap_inst *gti;
- int fd;
+ int fd, rc;
fd = gsmtap_source_init_fd(host, port);
if (fd < 0)
@@ -383,7 +387,11 @@ struct gsmtap_inst *gsmtap_source_init(const char *host, uint16_t port,
osmo_wqueue_init(&gti->wq, 64);
gti->wq.write_cb = &gsmtap_wq_w_cb;
- osmo_fd_register(&gti->wq.bfd);
+ rc = osmo_fd_register(&gti->wq.bfd);
+ if (rc < 0) {
+ close(fd);
+ return NULL;
+ }
}
return gti;