Change in ...osmo-sgsn[master]: sgsn_mm_ctx_alloc(): check for unallocated fsms

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Tue Oct 8 23:13:10 UTC 2019


lynxis lazus has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/15704 )

Change subject: sgsn_mm_ctx_alloc(): check for unallocated fsms
......................................................................

sgsn_mm_ctx_alloc(): check for unallocated fsms

Change-Id: I867612a60236eaf7009400c92f5d871006aaf008
---
M src/sgsn/gprs_sgsn.c
1 file changed, 25 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/sgsn/gprs_sgsn.c b/src/sgsn/gprs_sgsn.c
index 474f8f9..cb2c0fc 100644
--- a/src/sgsn/gprs_sgsn.c
+++ b/src/sgsn/gprs_sgsn.c
@@ -243,17 +243,42 @@
 		talloc_free(ctx);
 		return NULL;
 	}
+
 	ctx->gmm_fsm = osmo_fsm_inst_alloc(&gmm_fsm, ctx, ctx, LOGL_DEBUG, "gmm_fsm");
+	if (!ctx->gmm_fsm)
+		goto out;
 	ctx->gmm_att_req.fsm = osmo_fsm_inst_alloc(&gmm_attach_req_fsm, ctx, ctx, LOGL_DEBUG, "gb_gmm_req");
+	if (!ctx->gmm_att_req.fsm)
+		goto out;
 	ctx->gb.mm_state_fsm = osmo_fsm_inst_alloc(&mm_state_gb_fsm, ctx, ctx, LOGL_DEBUG, NULL);
+	if (!ctx->gb.mm_state_fsm)
+		goto out;
 #ifdef BUILD_IU
 	ctx->iu.mm_state_fsm = osmo_fsm_inst_alloc(&mm_state_iu_fsm, ctx, ctx, LOGL_DEBUG, NULL);
+	if (!ctx->iu.mm_state_fsm)
+		goto out;
 #endif
+
 	INIT_LLIST_HEAD(&ctx->pdp_list);
 
 	llist_add(&ctx->list, &sgsn_mm_ctxts);
 
 	return ctx;
+
+out:
+	if (ctx->iu.mm_state_fsm)
+		osmo_fsm_inst_free(ctx->iu.mm_state_fsm);
+	if (ctx->gb.mm_state_fsm)
+		osmo_fsm_inst_free(ctx->gb.mm_state_fsm);
+	if (ctx->gmm_att_req.fsm)
+		osmo_fsm_inst_free(ctx->gmm_att_req.fsm);
+	if (ctx->gmm_fsm)
+		osmo_fsm_inst_free(ctx->gmm_fsm);
+
+	rate_ctr_group_free(ctx->ctrg);
+	talloc_free(ctx);
+
+	return NULL;
 }
 /* Allocate a new SGSN MM context for GERAN_Gb */
 struct sgsn_mm_ctx *sgsn_mm_ctx_alloc_gb(uint32_t tlli,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/15704
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I867612a60236eaf7009400c92f5d871006aaf008
Gerrit-Change-Number: 15704
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191008/6b0e3175/attachment.htm>


More information about the gerrit-log mailing list