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
Thu Jan 17 12:48:45 UTC 2019


Vadim Yanitskiy has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c
index 23019fd..1350c3c 100644
--- a/src/host/trxcon/l1ctl_link.c
+++ b/src/host/trxcon/l1ctl_link.c
@@ -243,6 +243,16 @@
 		return -ENOMEM;
 	}
 
+	/* Allocate a new dedicated state machine */
+	l1l_new->fsm = osmo_fsm_inst_alloc(&l1ctl_fsm, l1l_new,
+		NULL, LOGL_DEBUG, "l1ctl_link");
+	if (l1l_new->fsm == NULL) {
+		LOGP(DTRX, LOGL_ERROR, "Failed to allocate an instance "
+			"of FSM '%s'\n", l1ctl_fsm.name);
+		talloc_free(l1l_new);
+		return -ENOMEM;
+	}
+
 	/* Create a socket and bind handlers */
 	bfd = &l1l_new->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_new->fsm);
 		talloc_free(l1l_new);
 		return rc;
 	}
@@ -268,10 +279,6 @@
 	 */
 	l1l_new->wq.bfd.fd = -1;
 
-	/* Allocate a new dedicated state machine */
-	l1l_new->fsm = osmo_fsm_inst_alloc(&l1ctl_fsm, l1l_new,
-		NULL, LOGL_DEBUG, "l1ctl_link");
-
 	*l1l = l1l_new;
 
 	return 0;

-- 
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: merged
Gerrit-Change-Id: Ibd9404a888f02798224238a7b9ff4ebf09f03850
Gerrit-Change-Number: 12587
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190117/f643511f/attachment.htm>


More information about the gerrit-log mailing list