laforge has uploaded this change for review.
rspro_server: Handle ipa_server_link_ipen() error case
>>> CID 307530: Error handling issues (CHECKED_RETURN)
>>> Calling "ipa_server_link_open" without checking return value (as is done elsewhere 4 out of 5
times).
Closes: COD#307530
Change-Id: Ic32d53a236b80711651fb4ee196ac3b95148e61f
---
M src/server/rspro_server.c
1 file changed, 13 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/81/31181/1
diff --git a/src/server/rspro_server.c b/src/server/rspro_server.c
index 550179d..27f9a99 100644
--- a/src/server/rspro_server.c
+++ b/src/server/rspro_server.c
@@ -844,6 +844,7 @@
{
struct rspro_server *srv = talloc_zero(ctx, struct rspro_server);
+ int rc;
OSMO_ASSERT(srv);
pthread_rwlock_init(&srv->rwlock, NULL);
@@ -854,14 +855,21 @@
pthread_rwlock_unlock(&srv->rwlock);
srv->link = ipa_server_link_create(ctx, NULL, host, port, accept_cb, srv);
- if (!srv->link) {
- talloc_free(srv);
- return NULL;
- }
+ if (!srv->link)
+ goto out_free;
- ipa_server_link_open(srv->link);
+ rc = ipa_server_link_open(srv->link);
+ if (rc < 0)
+ goto out_destroy;
return srv;
+
+out_destroy:
+ ipa_server_link_destroy(srv->link);
+out_free:
+ talloc_free(srv);
+
+ return NULL;
}
void rspro_server_destroy(struct rspro_server *srv)
To view, visit change 31181. To unsubscribe, or for help writing mail filters, visit settings.