Change in osmocom-bb[master]: trxcon/l1ctl_link.c: check if l1ctl_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:23 UTC 2019


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


Change subject: trxcon/l1ctl_link.c: check if l1ctl_fsm allocation failed
......................................................................

trxcon/l1ctl_link.c: check if l1ctl_fsm allocation failed

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



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/87/12587/1

diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c
index f2b031e..897259a 100644
--- a/src/host/trxcon/l1ctl_link.c
+++ b/src/host/trxcon/l1ctl_link.c
@@ -243,6 +243,16 @@
 		return NULL;
 	}
 
+	/* Allocate a new dedicated state machine */
+	l1l->fsm = osmo_fsm_inst_alloc(&l1ctl_fsm, l1l,
+		NULL, LOGL_DEBUG, "l1ctl_link");
+	if (l1l->fsm == NULL) {
+		LOGP(DTRX, LOGL_ERROR, "Failed to allocate an instance "
+			"of FSM '%s'\n", l1ctl_fsm.name);
+		talloc_free(l1l);
+		return NULL;
+	}
+
 	/* Create a socket and bind handlers */
 	bfd = &l1l->listen_bfd;
 	rc = osmo_sock_unix_init_ofd(bfd, SOCK_STREAM, 0, sock_path,
@@ -250,6 +260,7 @@
 	if (rc < 0) {
 		LOGP(DL1C, LOGL_ERROR, "Could not create UNIX socket: %s\n",
 			strerror(errno));
+		osmo_fsm_inst_free(l1l->fsm);
 		talloc_free(l1l);
 		return NULL;
 	}
@@ -268,10 +279,6 @@
 	 */
 	l1l->wq.bfd.fd = -1;
 
-	/* Allocate a new dedicated state machine */
-	l1l->fsm = osmo_fsm_inst_alloc(&l1ctl_fsm, l1l,
-		NULL, LOGL_DEBUG, "l1ctl_link");
-
 	return l1l;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/12587
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: Ibd9404a888f02798224238a7b9ff4ebf09f03850
Gerrit-Change-Number: 12587
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/81927f89/attachment.htm>


More information about the gerrit-log mailing list