Change in libosmocore[master]: gb/gprs_bssgb: check if talloc failed on btsctx->fc

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
Thu Sep 24 13:58:36 UTC 2020


lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20262 )

Change subject: gb/gprs_bssgb: check if talloc failed on btsctx->fc
......................................................................

gb/gprs_bssgb: check if talloc failed on btsctx->fc

Change-Id: I1cfccc2cb696d9e95f590b99559d0a987031adfe
---
M src/gb/gprs_bssgp.c
1 file changed, 12 insertions(+), 4 deletions(-)

Approvals:
  daniel: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 9c119fb..e5b4380 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -146,17 +146,25 @@
 	ctx->nsei = nsei;
 	/* FIXME: BVCI is not unique, only BVCI+NSEI ?!? */
 	ctx->ctrg = rate_ctr_group_alloc(ctx, &bssgp_ctrg_desc, bvci);
-	if (!ctx->ctrg) {
-		talloc_free(ctx);
-		return NULL;
-	}
+	if (!ctx->ctrg)
+		goto err_ctrg;
+
 	ctx->fc = talloc_zero(ctx, struct bssgp_flow_control);
+	if (!ctx->fc)
+		goto err_fc;
+
 	/* cofigure for 2Mbit, 30 packets in queue */
 	bssgp_fc_init(ctx->fc, 100000, 2*1024*1024/8, 30, &_bssgp_tx_dl_ud);
 
 	llist_add(&ctx->list, &bssgp_bvc_ctxts);
 
 	return ctx;
+
+err_fc:
+	rate_ctr_group_free(ctx->ctrg);
+err_ctrg:
+	talloc_free(ctx);
+	return NULL;
 }
 
 void bssgp_bvc_ctx_free(struct bssgp_bvc_ctx *ctx)

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1cfccc2cb696d9e95f590b99559d0a987031adfe
Gerrit-Change-Number: 20262
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
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/20200924/9dec4a03/attachment.htm>


More information about the gerrit-log mailing list