Change in osmocom-bb[master]: trxcon/trx_if.c: check if trx_fsm allocation failed

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Jan 16 13:18:24 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/12588


Change subject: trxcon/trx_if.c: check if trx_fsm allocation failed
......................................................................

trxcon/trx_if.c: check if trx_fsm allocation failed

Change-Id: I31c9f2a651182b258d0a4d4504365b778529715a
---
M src/host/trxcon/trx_if.c
1 file changed, 11 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/88/12588/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 5fe5000..f2db145 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -642,6 +642,16 @@
 		return NULL;
 	}
 
+	/* Allocate a new dedicated state machine */
+	trx->fsm = osmo_fsm_inst_alloc(&trx_fsm, trx,
+		NULL, LOGL_DEBUG, "trx_interface");
+	if (trx->fsm == NULL) {
+		LOGP(DTRX, LOGL_ERROR, "Failed to allocate an instance "
+			"of FSM '%s'\n", trx_fsm.name);
+		talloc_free(trx);
+		return NULL;
+	}
+
 	/* Initialize CTRL queue */
 	INIT_LLIST_HEAD(&trx->trx_ctrl_list);
 
@@ -656,14 +666,11 @@
 	if (rc < 0)
 		goto udp_error;
 
-	/* Allocate a new dedicated state machine */
-	trx->fsm = osmo_fsm_inst_alloc(&trx_fsm, trx,
-		NULL, LOGL_DEBUG, "trx_interface");
-
 	return trx;
 
 udp_error:
 	LOGP(DTRX, LOGL_ERROR, "Couldn't establish UDP connection\n");
+	osmo_fsm_inst_free(trx->fsm);
 	talloc_free(trx);
 	return NULL;
 }

-- 
To view, visit https://gerrit.osmocom.org/12588
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I31c9f2a651182b258d0a4d4504365b778529715a
Gerrit-Change-Number: 12588
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190116/c221753a/attachment.htm>


More information about the gerrit-log mailing list