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
This commit is contained in:
Holger Hans Peter Freyther 2013-07-14 08:58:15 +02:00
parent 921b2278df
commit c962d45669
1 changed files with 5 additions and 1 deletions

View File

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