summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-14 08:58:15 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-14 09:04:51 +0200
commitc962d45669ca5003952d36c6c0c94167f5b2f504 (patch)
tree64aacfdd7585e9ec8b7f59178ec792423c104542
parent921b2278df38077bb87afb33190511ac2431893d (diff)
smpp: Add the classic check for osmo_fd_register
In case the osmo_fd_register will fail we will need to free the memory we have allocated. Fixes: Coverity CID 1042375
-rw-r--r--openbsc/src/libmsc/smpp_smsc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/smpp_smsc.c b/openbsc/src/libmsc/smpp_smsc.c
index 6acd52a..2b17d12 100644
--- a/openbsc/src/libmsc/smpp_smsc.c
+++ b/openbsc/src/libmsc/smpp_smsc.c
@@ -878,7 +878,11 @@ static int link_accept_cb(struct smsc *smsc, int fd,
esme->wqueue.bfd.fd = fd;
esme->wqueue.bfd.data = esme;
esme->wqueue.bfd.when = BSC_FD_READ;
- osmo_fd_register(&esme->wqueue.bfd);
+
+ if (osmo_fd_register(&esme->wqueue.bfd) != 0) {
+ talloc_free(esme);
+ return -EIO;
+ }
esme->wqueue.read_cb = esme_link_read_cb;
esme->wqueue.write_cb = esme_link_write_cb;